]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
inet6: Mark temp addrs for regen
authorRoy Marples <roy@marples.name>
Wed, 29 Apr 2020 21:41:35 +0000 (22:41 +0100)
committerRoy Marples <roy@marples.name>
Wed, 29 Apr 2020 21:41:35 +0000 (22:41 +0100)
This solves an infinite loop where new temp addrs regened are
added at the tail and we loop endlessly.

src/ipv6.c
src/ipv6.h

index c039e7e6b72c6839441794bafa000ccd0f57a142..8ecdf62235647b18cf109934824c2a92485affbf 100644 (file)
@@ -2073,10 +2073,22 @@ ipv6_regentempaddrs(void *arg)
        ipv6_regen_desync(ifp, true);
 
        clock_gettime(CLOCK_MONOTONIC, &tv);
+
+       /* Mark addresses for regen so we don't infinite loop. */
        TAILQ_FOREACH(ia, &state->addrs, next) {
                if (ia->flags & IPV6_AF_TEMPORARY &&
                    !(ia->flags & IPV6_AF_STALE))
+                       ia->flags |= IPV6_AF_REGEN;
+               else
+                       ia->flags &= ~IPV6_AF_REGEN;
+       }
+
+       /* Now regen temp addrs */
+       TAILQ_FOREACH(ia, &state->addrs, next) {
+               if (ia->flags & IPV6_AF_REGEN) {
                        ipv6_regentempaddr0(ia, &tv);
+                       ia->flags &= ~IPV6_AF_REGEN;
+               }
        }
 }
 #endif /* IPV6_MANAGETEMPADDR */
index 005735d7c1b80f3d0883244b764e01feb1378ea6..b159827b5c791abc0846d839246287790099ffd8 100644 (file)
@@ -225,8 +225,9 @@ struct ipv6_addr {
 #define        IPV6_AF_DELEGATEDLOG    (1U << 11)
 #define        IPV6_AF_RAPFX           (1U << 12)
 #define        IPV6_AF_EXTENDED        (1U << 13)
+#define        IPV6_AF_REGEN           (1U << 14)
 #ifdef IPV6_MANAGETEMPADDR
-#define        IPV6_AF_TEMPORARY       (1U << 14)
+#define        IPV6_AF_TEMPORARY       (1U << 15)
 #endif
 
 struct ll_callback {