Skip to content

Commit 93305c2

Browse files
committed
DHCP6: release cleanly
While here address some hangup issues.
1 parent 5738d9c commit 93305c2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/dhcp6.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,12 +2110,10 @@ dhcp6_startrelease(struct interface *ifp)
21102110
struct dhcp6_state *state;
21112111

21122112
state = D6_STATE(ifp);
2113-
if (state->state != DH6S_BOUND)
2113+
if (state->state != DH6S_BOUND) {
2114+
dhcp6_finishrelease(ifp);
21142115
return;
2115-
2116-
/* RFC8415 18.2.7 says we must stop using the addresses before
2117-
* we send the release message. */
2118-
dhcp6_freedrop_addrs(ifp, 0, IPV6_AF_DELEGATED, NULL);
2116+
}
21192117

21202118
state->state = DH6S_RELEASE;
21212119
state->RTC = 0;

src/dhcpcd.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,9 +1187,6 @@ dhcpcd_handlelink(void *arg, unsigned short events)
11871187
{
11881188
struct dhcpcd_ctx *ctx = arg;
11891189

1190-
if (ctx->options & DHCPCD_EXITING)
1191-
return;
1192-
11931190
if (events != ELE_READ)
11941191
logerrx("%s: unexpected event 0x%04x", __func__, events);
11951192

src/privsep.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,10 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, unsigned short events,
11361136
struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1 };
11371137
bool stop = false;
11381138

1139+
if (events & ELE_HANGUP) {
1140+
len = 0;
1141+
goto stop;
1142+
}
11391143
if (!(events & ELE_READ))
11401144
logerrx("%s: unexpected event 0x%04x", __func__, events);
11411145

@@ -1163,6 +1167,7 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, unsigned short events,
11631167
}
11641168

11651169
if (stop) {
1170+
stop:
11661171
ctx->options |= DHCPCD_EXITING;
11671172
#ifdef PRIVSEP_DEBUG
11681173
logdebugx("process %d stopping", getpid());

0 commit comments

Comments
 (0)