changeset 2553:9a21dc3880d9 draft

Start the correct interface reference for added devices.
author Roy Marples <roy@marples.name>
date Mon, 30 Jun 2014 15:55:28 +0000
parents 8238b7cd09d7
children 3823ba691bbb
files dhcpcd.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Mon Jun 30 15:43:58 2014 +0000
+++ b/dhcpcd.c	Mon Jun 30 15:55:28 2014 +0000
@@ -721,7 +721,7 @@
 {
 	struct dhcpcd_ctx *ctx;
 	struct if_head *ifs;
-	struct interface *ifp, *ifn, *ifl = NULL;
+	struct interface *ifp, *iff, *ifn;
 	const char * const argv[] = { ifname };
 	int i;
 
@@ -754,23 +754,24 @@
 			continue;
 		i = 0;
 		/* Check if we already have the interface */
-		ifl = if_find(ctx, ifp->name);
-		if (ifl) {
-			syslog(LOG_DEBUG, "%s: interface updated", ifl->name);
+		iff = if_find(ctx, ifp->name);
+		if (iff) {
+			syslog(LOG_DEBUG, "%s: interface updated", iff->name);
 			/* The flags and hwaddr could have changed */
-			ifl->flags = ifp->flags;
-			ifl->hwlen = ifp->hwlen;
+			iff->flags = ifp->flags;
+			iff->hwlen = ifp->hwlen;
 			if (ifp->hwlen != 0)
-				memcpy(ifl->hwaddr, ifp->hwaddr, ifl->hwlen);
+				memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen);
 		} else {
 			syslog(LOG_DEBUG, "%s: interface added", ifp->name);
 			TAILQ_REMOVE(ifs, ifp, next);
 			TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
 			init_state(ifp, ctx->argc, ctx->argv);
 			run_preinit(ifp);
+			iff = ifp;
 		}
 		if (action > 0)
-			dhcpcd_startinterface(ifp);
+			dhcpcd_startinterface(iff);
 	}
 
 	/* Free our discovered list */