diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-08 20:43:04 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-08 20:43:04 +0100 |
commit | 81489b79e07d448f30434a0c1d22f8f744f0fda8 (patch) | |
tree | 0680afdea35c0c4ce19ab458e6e279f621ab18b0 /proto/radv/radv.c | |
parent | 716b904f4eb14349cdf66656eea0d90b040d51e5 (diff) |
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.
Diffstat (limited to 'proto/radv/radv.c')
-rw-r--r-- | proto/radv/radv.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/proto/radv/radv.c b/proto/radv/radv.c index 7e8950c5..22e4b2f4 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -281,17 +281,6 @@ radv_iface_add(struct object_lock *lock) radv_iface_notify(ifa, RA_EV_INIT); } -static inline struct ifa * -find_lladdr(struct iface *iface) -{ - struct ifa *a; - WALK_LIST(a, iface->addrs) - if (a->scope == SCOPE_LINK) - return a; - - return NULL; -} - static void radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_config *cf) { @@ -305,18 +294,12 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf ifa->ra = p; ifa->cf = cf; ifa->iface = iface; + ifa->addr = iface->llv6; init_list(&ifa->prefixes); ifa->prune_time = TIME_INFINITY; add_tail(&p->iface_list, NODE ifa); - ifa->addr = find_lladdr(iface); - if (!ifa->addr) - { - log(L_ERR "%s: Missing link-local address on interface %s", p->p.name, iface->name); - return; - } - timer *tm = tm_new(pool); tm->hook = radv_timer; tm->data = ifa; @@ -360,6 +343,10 @@ radv_if_notify(struct proto *P, unsigned flags, struct iface *iface) struct radv_iface_config *ic = (struct radv_iface_config *) iface_patt_find(&cf->patt_list, iface, NULL); + /* Ignore ifaces without link-local address */ + if (!iface->llv6) + return; + if (ic) radv_iface_new(p, iface, ic); |