summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-07-22 18:03:34 +0000
committerRoy Marples <roy@marples.name>2014-07-22 18:03:34 +0000
commitbfeb5ecd10290ec769e1b3883717bcb923294fd5 (patch)
treec3dc173f0f3b96c6fc8cc4150032548802ff92ec /dhcpcd.c
parent967db5951d0257f8cfc9f8a256dbc118c2145121 (diff)
downloaddhcpcd-bfeb5ecd10290ec769e1b3883717bcb923294fd5.tar.xz
When starting an interface and the carrier is UNKNOWN, wait 100ms before trying to start again.
UNKNOWN should only be reported for BSD systems where the carrier medium reports an error or is not valid. In this case the carrier is only UP when IFF_RUNNING is set.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index f9e12ca5..79e48ec8 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -610,14 +610,27 @@ dhcpcd_startinterface(void *arg)
struct if_options *ifo = ifp->options;
size_t i;
char buf[DUID_LEN * 3];
+ struct timeval tv;
pre_start(ifp);
if (if_up(ifp) == -1)
syslog(LOG_ERR, "%s: if_up: %m", ifp->name);
- if (ifp->carrier == LINK_DOWN && ifo->options & DHCPCD_LINK) {
- syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
- return;
+ if (ifo->options & DHCPCD_LINK) {
+ switch (ifp->carrier) {
+ case LINK_UP:
+ break;
+ case LINK_DOWN:
+ syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
+ return;
+ case LINK_UNKNOWN:
+ syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100;
+ eloop_timeout_add_tv(ifp->ctx->eloop, &tv,
+ dhcpcd_startinterface, ifp);
+ return;
+ }
}
if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) {