]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
With an unknown link, test carrier manually and loop 100ms.
authorRoy Marples <roy@marples.name>
Fri, 25 Jul 2014 12:49:53 +0000 (12:49 +0000)
committerRoy Marples <roy@marples.name>
Fri, 25 Jul 2014 12:49:53 +0000 (12:49 +0000)
dhcpcd.c

index 79e48ec871930bd109e25ba1bcf7c4065aec81ef..76e8d5ff44dd6b53526adfe99f63a6bac803b52a 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -342,8 +342,6 @@ configure_interface1(struct interface *ifp)
                ifo->options &= ~(DHCPCD_ARP | DHCPCD_IPV4LL);
        if (!(ifp->flags & (IFF_POINTOPOINT | IFF_LOOPBACK | IFF_MULTICAST)))
                ifo->options &= ~DHCPCD_IPV6RS;
-       if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_UNKNOWN)
-               ifo->options &= ~DHCPCD_LINK;
 
        if (ifo->metric != -1)
                ifp->metric = (unsigned int)ifo->metric;
@@ -617,6 +615,7 @@ 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;
@@ -624,6 +623,11 @@ dhcpcd_startinterface(void *arg)
                        syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
                        return;
                case LINK_UNKNOWN:
+                       /* No media state available, so we loop until
+                        * IFF_UP and IFF_RUNNING are set. */
+                       ifp->carrier = if_carrier(ifp);
+                       if (ifp->carrier != LINK_UNKNOWN)
+                               goto link_retry;
                        syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
                        tv.tv_sec = 0;
                        tv.tv_usec = 100;