]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
inet6: Expire ND on the second, not after it
authorRoy Marples <roy@marples.name>
Wed, 29 Apr 2020 15:06:04 +0000 (15:06 +0000)
committerRoy Marples <roy@marples.name>
Wed, 29 Apr 2020 15:06:04 +0000 (15:06 +0000)
Otherwise the timing is slightly confused.

src/ipv6nd.c

index fc84d3f58c5ca5f66dc6ba62f3ec4b80c2b33982..18f6c0a58dcedeeecf4fb17b7c51988f64b5420c 100644 (file)
@@ -647,7 +647,7 @@ ipv6nd_applyra(struct interface *ifp)
        };
 
        TAILQ_FOREACH(rap, ifp->ctx->ra_routers, next) {
-               if (rap->iface == ifp && rap->lifetime != 0)
+               if (rap->iface == ifp && !rap->expired)
                        break;
        }
 
@@ -1707,7 +1707,7 @@ ipv6nd_expirera(void *arg)
                if (rap->lifetime) {
                        elapsed = (uint32_t)eloop_timespec_diff(&now,
                            &rap->acquired, NULL);
-                       if (elapsed > rap->lifetime || rap->doexpire) {
+                       if (elapsed >= rap->lifetime || rap->doexpire) {
                                if (!rap->expired) {
                                        logwarnx("%s: %s: router expired",
                                            ifp->name, rap->sfrom);
@@ -1736,7 +1736,7 @@ ipv6nd_expirera(void *arg)
                        }
                        elapsed = (uint32_t)eloop_timespec_diff(&now,
                            &ia->acquired, NULL);
-                       if (elapsed > ia->prefix_vltime || rap->doexpire) {
+                       if (elapsed >= ia->prefix_vltime || rap->doexpire) {
                                if (ia->flags & IPV6_AF_ADDED) {
                                        logwarnx("%s: expired %s %s",
                                            ia->iface->name,
@@ -1817,7 +1817,7 @@ ipv6nd_expirera(void *arg)
                        }
 
                        ltime = ntohl(ltime);
-                       if (elapsed > ltime) {
+                       if (elapsed >= ltime) {
                                expired = true;
                                continue;
                        }