From 81489b79e07d448f30434a0c1d22f8f744f0fda8 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 8 Nov 2018 20:43:04 +0100 Subject: Nest: Improve keeping track of IPv6 link-local addresses Most protocols in IPv6 mode use link-local source addresses and expect that there is one on each active interface. The old code depended on assumption that if there is some IPv6 address on iface, there is also an IPv6 link-local address on that iface (added by kernel when the iface went up). Unfortunately, that is not generally true, as a configured global address sometimes ceases to be tentative (finishes DOD) before a link-local address on the same iface. In such case a protocol iface (namely RAdv and Babel) is activated, but fails to found link-local address and stays in failed state. The patch fixes that by tracking 'primary' IPv6 link-local address, sending iface restart notifications when it changes and making protocols ignore iface-up notifications when no such address is selected for an iface. --- proto/babel/babel.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'proto/babel/babel.c') diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 38be6909..0cfc2cac 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -1488,17 +1488,10 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con ifa->cf = ic; ifa->pool = pool; ifa->ifname = new->name; + ifa->addr = new->llv6->ip; add_tail(&p->interfaces, NODE ifa); - struct ifa *addr; - WALK_LIST(addr, new->addrs) - if (ipa_is_link_local(addr->ip)) - ifa->addr = addr->ip; - - if (ipa_zero(ifa->addr)) - log(L_WARN "%s: Cannot find link-local addr on %s", p->p.name, new->name); - init_list(&ifa->neigh_list); ifa->hello_seqno = 1; @@ -1551,6 +1544,10 @@ babel_if_notify(struct proto *P, unsigned flags, struct iface *iface) if (!(iface->flags & IF_MULTICAST)) return; + /* Ignore ifaces without link-local address */ + if (!iface->llv6) + return; + if (ic) babel_add_iface(p, iface, ic); -- cgit v1.2.3