Commit a6bb0d25 authored by Yohann D'Anello's avatar Yohann D'Anello

Better IP cleanup

Signed-off-by: Yohann D'Anello's avatarYohann D'ANELLO <ynerant@crans.org>
parent 251ae411
......@@ -366,9 +366,16 @@ def main():
ip('addr', my_ip + '/%s' % len(subnet),
'dev', config.main_interface)
# TODO Clean up the cleanup
ip('rule', 'from', 'all', 'lookup', '34072')
ip('route', 'table', '34072', 'local', my_ip, 'dev', config.main_interface)
subprocess.check_call(('ip', '-6', 'route', 'del', 'table', 'local', my_ip))
cleanup.append(lambda: subprocess.call(('ip', '-6', 'route', 'flush', 'table', '34071')))
cleanup.append(lambda: subprocess.call(('ip', '-6', 'route', 'flush', 'table', '34072')))
def clean_monitoring_addresses():
for address in tunnel_manager._neighbour_monitoring_addresses.values():
subprocess.check_call(('ip', '-6', 'address', 'del', address, 'dev', 'lo'))
cleanup.append(clean_monitoring_addresses)
ip('rule', 'from', my_subnet, 'to', my_subnet, 'iif', config.main_interface, 'lookup', '34071')
if_rt = ['ip', '-6', 'route', 'del',
'fe80::/64', 'dev', config.main_interface]
......
......@@ -715,10 +715,13 @@ class BaseTunnelManager(object):
# Add route in kernel
# FIXME Replace lo by main inteface name
subprocess.check_call(('ip', '-6', 'address', 'add', address, 'dev', 'lo'))
subprocess.check_call(('ip', '-6', 'route', 'del', address, 'dev', 'lo', 'table', 'main'))
subprocess.check_call(('ip', '-6', 'route', 'add', my_address, 'from', address,
'via', nexthop, 'dev', iface, 'src', address, 'table', '34071'))
subprocess.check_output(('ip', '-6', 'address', 'add', address, 'dev', 'lo'),
stderr=subprocess.STDOUT) # Ignore stderr
subprocess.check_output(('ip', '-6', 'route', 'del', address, 'dev', 'lo', 'table', 'main'),
stderr=subprocess.STDOUT)
subprocess.check_output(('ip', '-6', 'route', 'add', my_address, 'from', address,
'via', nexthop, 'dev', iface, 'src', address, 'table', '34071'),
stderr=subprocess.STDOUT)
def _updateCountry(self, address):
def update():
......
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