Commit fb3b8d10 authored by Killian Lufau's avatar Killian Lufau

fix disable-proto option

The default value for disable-proto is {'udp', 'udp6'}, and it's
not possible to get { <proto> } as a final value for disable-proto
when passing option `disable-proto <proto>`, because this results in
disable_proto being equal to {'udp', 'udp6', <proto>}.
Similarly, passing both `disable-proto <proto>`
and `disable-proto none` results in the `none` overwriting anything
else, resulting in disable_proto being an empty list. The goal here
is to allow to only keep the protocol we want to disable when passing
`disable-proto <proto>`, the default 'udp' and 'udp6' are in this case
only added to disable_proto if no disable-proto option is found.
parent d398aa93
......@@ -106,9 +106,10 @@ def getConfig():
help="Force each tunnel to be created through one the given gateways,"
" in a round-robin fashion.")
_('--disable-proto', action='append',
choices=('none', 'udp', 'tcp', 'udp6', 'tcp6'), default=['udp', 'udp6'],
choices=('none', 'udp', 'tcp', 'udp6', 'tcp6'),
help="Do never try to create tunnels using given protocols."
" 'none' has precedence over other options.")
" 'none' has precedence over other options."
" (default: ['udp', 'udp6'])")
_('--client', metavar='HOST,PORT,PROTO[;...]',
help="Do not run any OpenVPN server, but only 1 OpenVPN client,"
" with specified remotes. Any other option not required in this"
......@@ -155,7 +156,9 @@ def main():
if config.default and config.gateway:
sys.exit("error: conflicting options --default and --gateway")
if 'none' in config.disable_proto:
if config.disable_proto is None:
config.disable_proto = ['udp', 'udp6']
elif 'none' in config.disable_proto:
config.disable_proto = ()
if config.default:
# Make sure we won't tunnel over re6st.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment