]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Start the correct interface reference for added devices.
authorRoy Marples <roy@marples.name>
Mon, 30 Jun 2014 15:55:28 +0000 (15:55 +0000)
committerRoy Marples <roy@marples.name>
Mon, 30 Jun 2014 15:55:28 +0000 (15:55 +0000)
dhcpcd.c

index b0c66f5ccb0affb3becf4f99bc4ed0d06f1107df..45e8e92db9eedce8d092336fb2f6d4dcbec2611e 100644 (file)
--- 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 */