]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When stopping interfaces, skip past pseudo interfaces instead of finding
authorRoy Marples <roy@marples.name>
Fri, 7 Nov 2014 18:57:35 +0000 (18:57 +0000)
committerRoy Marples <roy@marples.name>
Fri, 7 Nov 2014 18:57:35 +0000 (18:57 +0000)
the master as only the masters are sorted correctly.

dhcpcd.c

index 22da5ab52ce2e2a1c5e38a8da9ec0d0f464c4b2a..2587dd7cb3e455d851fbe291355639f39462c646 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -970,18 +970,18 @@ reconf_reboot(struct dhcpcd_ctx *ctx, int action, int argc, char **argv, int oi)
 static void
 stop_all_interfaces(struct dhcpcd_ctx *ctx, int do_release)
 {
-       struct interface *ifp, *ifpm;
+       struct interface *ifp;
 
        /* drop_dhcp could change the order, so we do it like this. */
        for (;;) {
-               /* Be sane and drop the last config first */
-               ifp = TAILQ_LAST(ctx->ifaces, if_head);
+               /* Be sane and drop the last config first,
+                * skipping any pseudo interfaces */
+               TAILQ_FOREACH_REVERSE(ifp, ctx->ifaces, if_head, next) {
+                       if (!(ifp->options->options & DHCPCD_PFXDLGONLY))
+                               break;
+               }
                if (ifp == NULL)
                        break;
-               /* Stop the master interface only */
-               ifpm = if_find(ifp->ctx, ifp->name);
-               if (ifpm)
-                       ifp = ifpm;
                if (do_release) {
                        ifp->options->options |= DHCPCD_RELEASE;
                        ifp->options->options &= ~DHCPCD_PERSISTENT;