Commit 6a9571a9 authored by Jondy Zhao's avatar Jondy Zhao

Add all tap-drivers at startup;

Add subnet route at artup;
Remove --persist-tun for openvpn;
parent e599e3aa
...@@ -10,7 +10,7 @@ def openvpn(iface, encrypt, *args, **kw): ...@@ -10,7 +10,7 @@ def openvpn(iface, encrypt, *args, **kw):
args = ['openvpn', args = ['openvpn',
'--dev-type', 'tap', '--dev-type', 'tap',
'--dev-node' if sys.platform == 'cygwin' else '--dev', iface, '--dev-node' if sys.platform == 'cygwin' else '--dev', iface,
'--persist-tun', '' if sys.platform == 'cygwin' else '--persist-tun',
'--persist-key', '--persist-key',
'--script-security', '2', '--script-security', '2',
'--up', ovpn_client, '--up', ovpn_client,
......
...@@ -271,6 +271,9 @@ def main(): ...@@ -271,6 +271,9 @@ def main():
# not even remove it on exit. # not even remove it on exit.
subprocess.call(if_rt) subprocess.call(if_rt)
if_rt[4] = my_subnet if_rt[4] = my_subnet
if sys.platform == 'cygwin':
ip('route', my_subnet, 'dev', config.main_interface)
else:
cleanup.append(lambda: subprocess.call(if_rt)) cleanup.append(lambda: subprocess.call(if_rt))
x = [my_network] x = [my_network]
if config.table: if config.table:
...@@ -302,6 +305,11 @@ def main(): ...@@ -302,6 +305,11 @@ def main():
for cmd in config.daemon or (): for cmd in config.daemon or ():
cleanup.append(utils.Popen(cmd, shell=True).stop) cleanup.append(utils.Popen(cmd, shell=True).stop)
# adding tap-windows driver will break others, so we add
# all drivers here
if sys.platform == 'cygwin':
[ ip('vpntap', 'dev', x) for x in tunnel_interfaces ]
# main loop # main loop
if tunnel_manager is None: if tunnel_manager is None:
sys.exit(os.WEXITSTATUS(os.wait()[1])) sys.exit(os.WEXITSTATUS(os.wait()[1]))
......
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