]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Callout to handlecarrier when we don't have real carrier support
authorRoy Marples <roy@marples.name>
Mon, 6 Oct 2014 12:34:59 +0000 (12:34 +0000)
committerRoy Marples <roy@marples.name>
Mon, 6 Oct 2014 12:34:59 +0000 (12:34 +0000)
and rely on looking at IFF_UP and IFF_RUNNING.
This allows our hooks to know that dhcpcd thinks we have a carrier or not.

dhcpcd.c

index 0bd33a3f1ff38f69ae08154bab98551192fcc703..4b86c045fdb39e8b63fb531991574fdcd6d4f870 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -646,7 +646,6 @@ dhcpcd_startinterface(void *arg)
                syslog(LOG_ERR, "%s: if_up: %m", ifp->name);
 
        if (ifo->options & DHCPCD_LINK) {
-link_retry:
                switch (ifp->carrier) {
                case LINK_UP:
                        break;
@@ -660,9 +659,13 @@ link_retry:
                         * as we've done the best we can to bring the interface
                         * up at this point. */
                        ifp->carrier = if_carrier(ifp);
-                       if (ifp->carrier != LINK_UNKNOWN)
-                               goto link_retry;
-                       syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+                       if (ifp->carrier == LINK_UNKNOWN) {
+                               syslog(LOG_INFO, "%s: unknown carrier",
+                                   ifp->name);
+                               return;
+                       }
+                       dhcpcd_handlecarrier(ifp->ctx, ifp->carrier,
+                           ifp->flags, ifp->name);
                        return;
                }
        }
@@ -1618,8 +1621,8 @@ main(int argc, char **argv)
                ctx.options |= DHCPCD_WAITIP;
 
        /* RTM_NEWADDR goes through the link socket as well which we
-        * need for IPv6 DAD, so we check for DHCPCD_LINK in handle_carrier
-        * instead.
+        * need for IPv6 DAD, so we check for DHCPCD_LINK in
+        * dhcpcd_handlecarrier instead.
         * We also need to open this before checking for interfaces below
         * so that we pickup any new addresses during the discover phase. */
        ctx.link_fd = if_openlinksocket();