]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: lastlease behavior after Confirm non-response (#387)
authorJon Franklin <jvfranklin@gmail.com>
Tue, 29 Oct 2024 07:53:51 +0000 (02:53 -0500)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2024 07:53:51 +0000 (07:53 +0000)
If lastlease is enabled, and dhcpcd is unable to confirm its prior
lease, after timeout, bind the lease and move to the REBIND state.
Confine lastlease behavior to the CONFIRM and REBIND states.

Co-authored-by: Jon Franklin <jon_franklin@dell.com>
src/dhcp6.c

index 4b5524062bb46357a08aaf46189495cdbe1a288a..3fcb4b71ccce515a2dcc9c8ce39f89aff003e6cd 100644 (file)
@@ -187,6 +187,7 @@ static const char * const dhcp6_statuses[] = {
 
 static void dhcp6_bind(struct interface *, const char *, const char *);
 static void dhcp6_failinform(void *);
+static void dhcp6_startrebind(void *arg);
 static void dhcp6_recvaddr(void *, unsigned short);
 static void dhcp6_startdecline(struct interface *);
 static void dhcp6_startrequest(struct interface *);
@@ -1760,8 +1761,12 @@ dhcp6_fail(struct interface *ifp, bool drop)
                dhcp_unlink(ifp->ctx, state->leasefile);
                dhcp6_addrequestedaddrs(ifp);
                eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
-       } else if (state->recv && ifp->options->options & DHCPCD_LASTLEASE) {
+       } else if ((state->state == DH6S_CONFIRM || state->state == DH6S_REBIND) &&
+                  ifp->options->options & DHCPCD_LASTLEASE) {
                dhcp6_bind(ifp, NULL, NULL);
+               state->state = DH6S_REBIND;
+               dhcp6_startrebind(ifp);
+               return;
        } else if (state->new) {
                script_runreason(ifp, "TIMEOUT6");
                // We need to keep the expire timeout alive