From: Roy Marples Date: Tue, 14 Nov 2017 15:37:23 +0000 (+0000) Subject: IPv6ND: Fix lifetime overflow on carrier up X-Git-Tag: v7.0.0-rc4~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d10ed4e3abe18d3757309a257f6035f4fc04038;p=thirdparty%2Fdhcpcd.git IPv6ND: Fix lifetime overflow on carrier up Set the acquired time of the address to now as we're forcing short vltime and pltime. --- diff --git a/src/ipv6nd.c b/src/ipv6nd.c index a35381f7..a5b032ed 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -336,6 +336,8 @@ ipv6nd_expire(struct interface *ifp, uint32_t seconds) { struct ra *rap; struct timespec now; + uint32_t vltime = seconds; + uint32_t pltime = seconds / 2; if (ifp->ctx->ra_routers == NULL) return; @@ -347,13 +349,18 @@ ipv6nd_expire(struct interface *ifp, uint32_t seconds) rap->acquired = now; rap->expired = seconds ? 0 : 1; if (seconds) { - struct ipv6_addr *ap; + struct ipv6_addr *ia; rap->lifetime = seconds; - TAILQ_FOREACH(ap, &rap->addrs, next) { - if (ap->prefix_vltime) { - ap->prefix_vltime = seconds; - ap->prefix_pltime = seconds / 2; + TAILQ_FOREACH(ia, &rap->addrs, next) { + if (ia->prefix_pltime > pltime || + ia->prefix_vltime > vltime) + { + ia->acquired = now; + if (ia->prefix_pltime != 0) + ia->prefix_pltime = + pltime; + ia->prefix_vltime = vltime; } } ipv6_addaddrs(&rap->addrs);