]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: release cleanly
authorRoy Marples <roy@marples.name>
Mon, 3 Nov 2025 14:33:17 +0000 (14:33 +0000)
committerRoy Marples <roy@marples.name>
Mon, 3 Nov 2025 14:33:17 +0000 (14:33 +0000)
While here address some hangup issues.

src/dhcp6.c
src/dhcpcd.c
src/privsep.c

index db73182feb2417919bc8db93425ad6150d5c42fe..2cca6e6dc249eaa565bb992424c0257299ccab2e 100644 (file)
@@ -2110,12 +2110,10 @@ dhcp6_startrelease(struct interface *ifp)
        struct dhcp6_state *state;
 
        state = D6_STATE(ifp);
-       if (state->state != DH6S_BOUND)
+       if (state->state != DH6S_BOUND) {
+               dhcp6_finishrelease(ifp);
                return;
-
-       /* RFC8415 18.2.7 says we must stop using the addresses before
-        * we send the release message. */
-       dhcp6_freedrop_addrs(ifp, 0, IPV6_AF_DELEGATED, NULL);
+       }
 
        state->state = DH6S_RELEASE;
        state->RTC = 0;
index 849e538b8c29aec9eabf2a085d735e59e1af2c91..be95ecbdd44a113ac72a9e5a3f69a07735e42196 100644 (file)
@@ -1187,9 +1187,6 @@ dhcpcd_handlelink(void *arg, unsigned short events)
 {
        struct dhcpcd_ctx *ctx = arg;
 
-       if (ctx->options & DHCPCD_EXITING)
-               return;
-
        if (events != ELE_READ)
                logerrx("%s: unexpected event 0x%04x", __func__, events);
 
index 1fff0798b0964603dd02d573bf0e77198309b5fc..76668fb2a029f8f9a7e8145c817e0f67982ee213 100644 (file)
@@ -1136,6 +1136,10 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, unsigned short events,
        struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1 };
        bool stop = false;
 
+       if (events & ELE_HANGUP) {
+               len = 0;
+               goto stop;
+       }
        if (!(events & ELE_READ))
                logerrx("%s: unexpected event 0x%04x", __func__, events);
 
@@ -1163,6 +1167,7 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, unsigned short events,
        }
 
        if (stop) {
+stop:
                ctx->options |= DHCPCD_EXITING;
 #ifdef PRIVSEP_DEBUG
                logdebugx("process %d stopping", getpid());