summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-05-16 15:03:28 +0000
committerRoy Marples <roy@marples.name>2014-05-16 15:03:28 +0000
commit0b32a745d347429beb53ddfba9ec4596b0b2e8e2 (patch)
tree45daa75ba968999d4b73afd6185cb76ed507fe73 /dhcpcd.c
parent51ec4f3c447e0f1014d4e2f56210bdb76e89d41b (diff)
downloaddhcpcd-0b32a745d347429beb53ddfba9ec4596b0b2e8e2.tar.xz
Only remove the interface from the list once all callouts have been
completed.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index ac953463..fe869c11 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -301,8 +301,6 @@ stop_interface(struct interface *ifp)
syslog(LOG_INFO, "%s: removing interface", ifp->name);
ifp->options->options |= DHCPCD_STOPPING;
- // Remove the interface from our list
- TAILQ_REMOVE(ifp->ctx->ifaces, ifp, next);
dhcp6_drop(ifp, NULL);
ipv6nd_drop(ifp);
dhcp_drop(ifp, "STOP");
@@ -311,7 +309,11 @@ stop_interface(struct interface *ifp)
script_runreason(ifp, "DEPARTED");
else
script_runreason(ifp, "STOPPED");
+
+ // Remove the interface from our list
+ TAILQ_REMOVE(ifp->ctx->ifaces, ifp, next);
if_free(ifp);
+
if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST)))
eloop_exit(ctx->eloop, EXIT_FAILURE);
}