]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only remove the interface from the list once all callouts have been
authorRoy Marples <roy@marples.name>
Fri, 16 May 2014 15:03:28 +0000 (15:03 +0000)
committerRoy Marples <roy@marples.name>
Fri, 16 May 2014 15:03:28 +0000 (15:03 +0000)
completed.

dhcpcd.c

index ac953463dc10b0d5c94a31ab758c63a546efe9b9..fe869c119c464e9c0f133496de917343a43d1541 100644 (file)
--- 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);
 }