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

redistribute default routes with src-prefix

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