From: Roy Marples Date: Mon, 10 Sep 2018 11:02:55 +0000 (+0100) Subject: dhcp6: always move to the DISCOVER phase if the offered lease is invalid X-Git-Tag: v7.1.0~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=838c5eba20279f98f4d9b0daaae158497143ecf5;p=thirdparty%2Fdhcpcd.git dhcp6: always move to the DISCOVER phase if the offered lease is invalid --- diff --git a/src/dhcp6.c b/src/dhcp6.c index de51ee56..2a6dcb25 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -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;