From: Roy Marples Date: Mon, 30 Jun 2014 15:55:28 +0000 (+0000) Subject: Start the correct interface reference for added devices. X-Git-Tag: v6.4.1~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3070a5c95b907f54e679d1123b2f441507209acb;p=thirdparty%2Fdhcpcd.git Start the correct interface reference for added devices. --- diff --git a/dhcpcd.c b/dhcpcd.c index b0c66f5c..45e8e92d 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -721,7 +721,7 @@ dhcpcd_handleinterface(void *arg, int action, const char *ifname) { 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 @@ dhcpcd_handleinterface(void *arg, int action, const char *ifname) 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 */