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,
......
...@@ -270,8 +270,11 @@ def main(): ...@@ -270,8 +270,11 @@ def main():
# WKRD: Removed this useless route now, since the kernel does # WKRD: Removed this useless route now, since the kernel does
# 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
cleanup.append(lambda: subprocess.call(if_rt)) if sys.platform == 'cygwin':
ip('route', my_subnet, 'dev', config.main_interface)
else:
cleanup.append(lambda: subprocess.call(if_rt))
x = [my_network] x = [my_network]
if config.table: if config.table:
x += 'table', str(config.table) x += 'table', str(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