Skip to content

Commit eac7152

Browse files
committed
DHCP: Fix crash when someone deletes our address
Fixes #455
1 parent 68deb69 commit eac7152

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ipv4.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ ipv4_deladdr(struct ipv4_addr *addr, int keeparp)
524524
struct ipv4_state *state;
525525
struct ipv4_addr *ap;
526526

527+
assert(addr != NULL);
527528
logdebugx("%s: deleting IP address %s",
528529
addr->iface->name, addr->saddr);
529530

@@ -760,7 +761,9 @@ ipv4_applyaddr(void *arg)
760761
(DHCPCD_EXITING | DHCPCD_PERSISTENT))
761762
{
762763
if (state->added) {
763-
ipv4_deladdr(state->addr, 0);
764+
/* Someone might have deleted our address */
765+
if (state->addr != NULL)
766+
ipv4_deladdr(state->addr, 0);
764767
rt_build(ifp->ctx, AF_INET);
765768
}
766769
script_runreason(ifp, state->reason);

0 commit comments

Comments
 (0)