From f9f9bc4a4ee36377d4c04f01a26cc227ff96cbc3 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 6 Oct 2014 12:34:59 +0000 Subject: [PATCH] Callout to handlecarrier when we don't have real carrier support 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dhcpcd.c b/dhcpcd.c index 0bd33a3f..4b86c045 100644 --- 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();