summaryrefslogtreecommitdiff
path: root/proto/rip/rip.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-11-28 16:43:17 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-11-28 16:55:32 +0100
commite2ae08694e45b2a127c9d741e41dee4b14c2964d (patch)
tree474fea3661e03e2b82130beb493ac8a4a79844fc /proto/rip/rip.c
parent66934aceff0e5299719177782bcbf151f8030591 (diff)
Nest: Do not hard-reset interface when preferred address is changed
Modify protocols to use preferred address change notification instead on depending on hard-reset of interfaces in that case, and remove hard-reset in that case. This avoids issue when e.g. IPv6 protocol restarts interface when IPv4 preferred address changed (as hard-reset is unavoidable and common for whole iface). The patch also fixes a bug when removing last address does not send preferred address change notification.
Diffstat (limited to 'proto/rip/rip.c')
-rw-r--r--proto/rip/rip.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 2838d425..612b6f92 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -746,35 +746,34 @@ rip_if_notify(struct proto *P, unsigned flags, struct iface *iface)
{
struct rip_proto *p = (void *) P;
struct rip_config *cf = (void *) P->cf;
+ struct rip_iface *ifa = rip_find_iface(p, iface);
if (iface->flags & IF_IGNORE)
return;
- if (flags & IF_CHANGE_UP)
+ /* Add, remove or restart interface */
+ if (flags & (IF_CHANGE_UPDOWN | (rip_is_v2(p) ? IF_CHANGE_ADDR4 : IF_CHANGE_LLV6)))
{
- struct rip_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL);
+ if (ifa)
+ rip_remove_iface(p, ifa);
+
+ if (!(iface->flags & IF_UP))
+ return;
/* Ignore ifaces without appropriate address */
if (rip_is_v2(p) ? !iface->addr4 : !iface->llv6)
return;
+ struct rip_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL);
if (ic)
rip_add_iface(p, iface, ic);
return;
}
- struct rip_iface *ifa = rip_find_iface(p, iface);
-
if (!ifa)
return;
- if (flags & IF_CHANGE_DOWN)
- {
- rip_remove_iface(p, ifa);
- return;
- }
-
if (flags & IF_CHANGE_MTU)
rip_iface_update_buffers(ifa);