]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When receiving a RA, mark all addresses as stale. For each address
authorRoy Marples <roy@marples.name>
Tue, 14 Oct 2014 23:42:14 +0000 (23:42 +0000)
committerRoy Marples <roy@marples.name>
Tue, 14 Oct 2014 23:42:14 +0000 (23:42 +0000)
created in the RA, remove the stale marking.
Addresses marked stale won't be re-added so will naturally expire.

ipv6.c
ipv6nd.c

diff --git a/ipv6.c b/ipv6.c
index 62f5b682076c7ead873de656e003399a379f7788..2e062d9e06e8f10ee2daed0fa2e01e592915a3f7 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -713,7 +713,9 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs)
                                TAILQ_REMOVE(addrs, ap, next);
                                free(ap);
                        }
-               } else if (!IN6_IS_ADDR_UNSPECIFIED(&ap->addr)) {
+               } else if (!(ap->flags & IPV6_AF_STALE) &&
+                   !IN6_IS_ADDR_UNSPECIFIED(&ap->addr))
+               {
                        apf = ipv6_findaddr(ap->iface->ctx,
                            &ap->addr, IPV6_AF_ADDED);
                        if (apf && apf->iface != ap->iface) {
index 859ec69b238ba7722c5dde1e05fe8d24df3317c4..0fd39334b15861e085744274271c17ad926bae6c 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -827,6 +827,10 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
        if (rap->lifetime)
                rap->expired = 0;
 
+       TAILQ_FOREACH(ap, &rap->addrs, next) {
+               ap->flags |= IPV6_AF_STALE;
+       }
+
        len -= sizeof(struct nd_router_advert);
        p = ((uint8_t *)icp) + sizeof(struct nd_router_advert);
        lifetime = ~0U;
@@ -923,7 +927,8 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                }
                                ap->dadcallback = ipv6nd_dadcallback;
                                TAILQ_INSERT_TAIL(&rap->addrs, ap, next);
-                       }
+                       } else
+                               ap->flags &= ~IPV6_AF_STALE;
                        if (pi->nd_opt_pi_flags_reserved &
                            ND_OPT_PI_FLAG_ONLINK)
                                ap->flags |= IPV6_AF_ONLINK;