diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-28 16:43:17 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-28 16:55:32 +0100 |
commit | e2ae08694e45b2a127c9d741e41dee4b14c2964d (patch) | |
tree | 474fea3661e03e2b82130beb493ac8a4a79844fc /proto/radv/radv.c | |
parent | 66934aceff0e5299719177782bcbf151f8030591 (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/radv/radv.c')
-rw-r--r-- | proto/radv/radv.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/proto/radv/radv.c b/proto/radv/radv.c index a381f737..12d90823 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -330,13 +330,19 @@ radv_if_notify(struct proto *P, unsigned flags, struct iface *iface) { struct radv_proto *p = (struct radv_proto *) P; struct radv_config *cf = (struct radv_config *) (P->cf); + struct radv_iface *ifa = radv_iface_find(p, iface); if (iface->flags & IF_IGNORE) return; - if (flags & IF_CHANGE_UP) + /* Add, remove or restart interface */ + if (flags & (IF_CHANGE_UPDOWN | IF_CHANGE_LLV6)) { - struct radv_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL); + if (ifa) + radv_iface_remove(ifa); + + if (!(iface->flags & IF_UP)) + return; /* Ignore non-multicast ifaces */ if (!(iface->flags & IF_MULTICAST)) @@ -346,22 +352,16 @@ radv_if_notify(struct proto *P, unsigned flags, struct iface *iface) if (!iface->llv6) return; + struct radv_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL); if (ic) radv_iface_new(p, iface, ic); return; } - struct radv_iface *ifa = radv_iface_find(p, iface); if (!ifa) return; - if (flags & IF_CHANGE_DOWN) - { - radv_iface_remove(ifa); - return; - } - if ((flags & IF_CHANGE_LINK) && (iface->flags & IF_LINK_UP)) radv_iface_notify(ifa, RA_EV_INIT); } |