]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: Set all requested addrs as not stale when starting discovery
authorRoy Marples <roy@marples.name>
Wed, 4 Oct 2023 16:38:08 +0000 (17:38 +0100)
committerRoy Marples <roy@marples.name>
Wed, 4 Oct 2023 16:38:08 +0000 (17:38 +0100)
Hopefully fixes #249.

src/dhcp6.c

index 7e5b66cd02dc67117a2a0c620cc3b573b6f0bf93..63fe2dc64584ce81f1b5060a52b52d42af639f91 100644 (file)
@@ -1630,6 +1630,7 @@ dhcp6_startdiscover(void *arg)
        struct interface *ifp;
        struct dhcp6_state *state;
        int llevel;
+       struct ipv6_addr *ia;
 
        ifp = arg;
        state = D6_STATE(ifp);
@@ -1654,6 +1655,14 @@ dhcp6_startdiscover(void *arg)
        state->new = NULL;
        state->new_len = 0;
 
+       /* If we fail to renew or confirm, our requested addreses will
+        * be marked as stale.
+        To re-request them, just mark them as not stale. */
+       TAILQ_FOREACH(ia, &state->addrs, next) {
+               if (ia->flags & IPV6_AF_REQUEST)
+                       ia->flags &= ~IPV6_AF_STALE;
+       }
+
        if (dhcp6_makemessage(ifp) == -1)
                logerr("%s: %s", __func__, ifp->name);
        else
@@ -2270,9 +2279,7 @@ dhcp6_findpd(struct interface *ifp, const uint8_t *iaid,
                } else {
                        if (!(a->flags & IPV6_AF_DELEGATEDPFX))
                                a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX;
-                       a->flags &= ~(IPV6_AF_STALE |
-                                     IPV6_AF_EXTENDED |
-                                     IPV6_AF_REQUEST);
+                       a->flags &= ~(IPV6_AF_STALE | IPV6_AF_EXTENDED);
                        if (a->prefix_vltime != pdp.vltime)
                                a->flags |= IPV6_AF_NEW;
                }