summaryrefslogtreecommitdiff
path: root/proto/rip
diff options
context:
space:
mode:
Diffstat (limited to 'proto/rip')
-rw-r--r--proto/rip/packets.c9
-rw-r--r--proto/rip/rip.c4
2 files changed, 5 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;
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 7b380097..88d7b7c8 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -764,6 +764,10 @@ rip_if_notify(struct proto *P, unsigned flags, struct iface *iface)
{
struct rip_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL);
+ /* For RIPng, ignore ifaces without link-local address */
+ if (rip_is_ng(p) && !ifa_llv6(iface))
+ return;
+
if (ic)
rip_add_iface(p, iface, ic);