diff options
| author | Roy Marples <roy@marples.name> | 2009-11-20 15:14:27 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-11-20 15:14:27 +0000 |
| commit | 68510bef057857947e44320e4d67ec2a54fcf204 (patch) | |
| tree | de30d1a84fff0f875aaa40a5ec0a483e57973c5f /dhcpcd.c | |
| parent | 9ca488bb6d7fe0311db4389613d37f3019ccc493 (diff) | |
| download | dhcpcd-68510bef057857947e44320e4d67ec2a54fcf204.tar.xz | |
If we have to bring an interface up, and we don't have any carriers
then we need to wait for a second to allow an interface to settle.
Diffstat (limited to 'dhcpcd.c')
| -rw-r--r-- | dhcpcd.c | 42 |
1 files changed, 32 insertions, 10 deletions
@@ -1806,16 +1806,38 @@ main(int argc, char **argv) if (iface->carrier != LINK_DOWN) opt = 1; } - if (opt == 0 && - options & DHCPCD_LINK && - !(options & DHCPCD_WAITIP)) - { - syslog(LOG_WARNING, "no interfaces have a carrier"); - daemonise(); - } else if (options & DHCPCD_DAEMONISE && ifo->timeout > 0) { - if (options & DHCPCD_IPV4LL) - options |= DHCPCD_TIMEOUT_IPV4LL; - add_timeout_sec(ifo->timeout, handle_exit_timeout, NULL); + + if (!(options & DHCPCD_BACKGROUND)) { + /* If we don't have a carrier, we may have to wait for a second + * before one becomes available if we brought an interface up. */ + if (opt == 0 && + options & DHCPCD_LINK && + options & DHCPCD_WAITUP && + !(options & DHCPCD_WAITIP)) + { + ts.tv_sec = 1; + ts.tv_nsec = 0; + nanosleep(&ts, NULL); + for (iface = ifaces; iface; iface = iface->next) { + handle_carrier(iface->name); + if (iface->carrier != LINK_DOWN) { + opt = 1; + break; + } + } + } + if (opt == 0 && + options & DHCPCD_LINK && + !(options & DHCPCD_WAITIP)) + { + syslog(LOG_WARNING, "no interfaces have a carrier"); + daemonise(); + } else if (options & DHCPCD_DAEMONISE && ifo->timeout > 0) { + if (options & DHCPCD_IPV4LL) + options |= DHCPCD_TIMEOUT_IPV4LL; + add_timeout_sec(ifo->timeout, handle_exit_timeout, NULL); + } + } free_options(ifo); |
