From 838c5eba20279f98f4d9b0daaae158497143ecf5 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 10 Sep 2018 12:02:55 +0100 Subject: [PATCH] dhcp6: always move to the DISCOVER phase if the offered lease is invalid --- src/dhcp6.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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; -- 2.47.2