summaryrefslogtreecommitdiff
path: root/proto/rip/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-11-08 20:43:04 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-11-08 20:43:04 +0100
commit81489b79e07d448f30434a0c1d22f8f744f0fda8 (patch)
tree0680afdea35c0c4ce19ab458e6e279f621ab18b0 /proto/rip/packets.c
parent716b904f4eb14349cdf66656eea0d90b040d51e5 (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/rip/packets.c')
-rw-r--r--proto/rip/packets.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/proto/rip/packets.c b/proto/rip/packets.c
index 722a9012..d2f968d3 100644
--- a/proto/rip/packets.c
+++ b/proto/rip/packets.c
@@ -739,16 +739,9 @@ rip_open_socket(struct rip_iface *ifa)
sk->sport = ifa->cf->port;
sk->dport = ifa->cf->port;
sk->iface = ifa->iface;
+ sk->saddr = rip_is_v2(p) ? ifa->iface->addr->ip : ifa_llv6(ifa->iface)->ip;
sk->vrf = p->p.vrf;
- /*
- * For RIPv2, we explicitly choose a primary address, mainly to ensure that
- * RIP and BFD uses the same one. For RIPng, we left it to kernel, which
- * should choose some link-local address based on the same scope rule.
- */
- if (rip_is_v2(p))
- sk->saddr = ifa->iface->addr->ip;
-
sk->rx_hook = rip_rx_hook;
sk->tx_hook = rip_tx_hook;
sk->err_hook = rip_err_hook;