]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcp6: always move to the DISCOVER phase if the offered lease is invalid
authorRoy Marples <roy@marples.name>
Mon, 10 Sep 2018 11:02:55 +0000 (12:02 +0100)
committerRoy Marples <roy@marples.name>
Mon, 10 Sep 2018 11:02:55 +0000 (12:02 +0100)
src/dhcp6.c

index de51ee5657541c556e3c6fa489520068ddd0bb80..2a6dcb2540f0d274411b2f4e1f8ead20d933355a 100644 (file)
@@ -3299,15 +3299,26 @@ dhcp6_recvif(struct interface *ifp, struct dhcp6_message *r, size_t len)
                        if (dhcp6_validatelease(ifp, r, len,
                            ctx->sfrom, NULL) == -1)
                        {
-#ifndef SMALL
-                               /* PD doesn't use CONFIRM, so REBIND could
-                                * throw up an invalid prefix if we
-                                * changed link */
-                               if (state->state == DH6S_REBIND &&
-                                   dhcp6_hasprefixdelegation(ifp))
+                               /*
+                                * If we can't use the lease, fallback to
+                                * DISCOVER and try and get a new one.
+                                *
+                                * This is needed become some servers
+                                * renumber the prefix or address
+                                * and deny the current one before it expires
+                                * rather than sending it back with a zero
+                                * lifetime along with the new prefix or
+                                * address to use.
+                                * This behavior is wrong, but moving to the
+                                * DISCOVER phase works around it.
+                                *
+                                * The currently held lease is still valid
+                                * until a new one is found.
+                                */
+                               if (state->state != DH6S_DISCOVER) {
                                        dhcp6_startdiscover(ifp);
-#endif
-                               return;
+                                       return;
+                               }
                        }
                        if (state->state == DH6S_DISCOVER)
                                state->state = DH6S_REQUEST;