changeset 2831:07f15b6be4fb draft

When stopping interfaces, skip past pseudo interfaces instead of finding the master as only the masters are sorted correctly.
author Roy Marples <roy@marples.name>
date Fri, 07 Nov 2014 18:57:35 +0000
parents 4fb95ea337bf
children 5746a9f0a44a
files dhcpcd.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Fri Nov 07 09:59:53 2014 +0000
+++ b/dhcpcd.c	Fri Nov 07 18:57:35 2014 +0000
@@ -970,18 +970,18 @@
 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;