Commit 47f69a00 authored by Joanne Hugé's avatar Joanne Hugé

redistribute default routes with src-prefix

parent 4d542109
...@@ -421,9 +421,8 @@ def main(): ...@@ -421,9 +421,8 @@ def main():
config.babel_args += config.iface_list config.babel_args += config.iface_list
cleanup.append(plib.router((my_ip, len(subnet)), ipv4, cleanup.append(plib.router((my_ip, len(subnet)), ipv4,
None if config.gateway else my_network if config.gateway or config.default else None,
'' if config.default else config.gateway, cache.hello,
my_network, cache.hello,
os.path.join(config.log, 'babeld.log'), os.path.join(config.log, 'babeld.log'),
os.path.join(config.state, 'babeld.state'), os.path.join(config.state, 'babeld.state'),
os.path.join(config.run, 'babeld.pid'), os.path.join(config.run, 'babeld.pid'),
......
...@@ -62,7 +62,7 @@ def client(iface, address_list, encrypt, *args, **kw): ...@@ -62,7 +62,7 @@ def client(iface, address_list, encrypt, *args, **kw):
return openvpn(iface, encrypt, *remote, **kw) return openvpn(iface, encrypt, *remote, **kw)
def router(ip, ip4, src, hello_interval, log_path, state_path, pidfile, def router(ip, ip4, src, gateway, hello_interval, log_path, state_path, pidfile,
control_socket, default, hmac, *args, **kw): control_socket, default, hmac, *args, **kw):
ip, n = ip ip, n = ip
hmac_sign, hmac_accept = hmac hmac_sign, hmac_accept = hmac
...@@ -98,11 +98,12 @@ def router(ip, ip4, src, hello_interval, log_path, state_path, pidfile, ...@@ -98,11 +98,12 @@ def router(ip, ip4, src, hello_interval, log_path, state_path, pidfile,
if ip4: if ip4:
cmd += '-C', 'redistribute ip %s/%s eq %s' % (ip4, n4, n4) cmd += '-C', 'redistribute ip %s/%s eq %s' % (ip4, n4, n4)
if src: if src:
cmd += '-C', 'install ip ::/0 eq 0 src-prefix ' + src if gateway:
elif src is None: cmd += '-C', 'redistribute ip ::/0 eq 0 src-prefix ' + src
cmd += '-C', 'redistribute ip ::/0 eq 0' else:
cmd += '-C', 'install ip ::/0 eq 0 src-prefix ' + src + ' pref-src ' + ip
cmd += ('-C', 'redistribute deny', cmd += ('-C', 'redistribute deny',
'-C', 'install pref-src ' + ip) '-C', 'install ip ::/0 ge 1 pref-src ' + ip)
if ip4: if ip4:
cmd += '-C', 'install pref-src ' + ip4 cmd += '-C', 'install pref-src ' + ip4
if control_socket: if control_socket:
......
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