From: Roy Marples Date: Thu, 8 Oct 2009 19:56:52 +0000 (+0000) Subject: Add an extra timeout for IPv4LL when in use. X-Git-Tag: v5.1.2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f19df563b046a25ef610ba6960eabdb72dae49a7;p=thirdparty%2Fdhcpcd.git Add an extra timeout for IPv4LL when in use. --- diff --git a/dhcpcd.c b/dhcpcd.c index cff3fde4..535fa753 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -185,11 +185,18 @@ cleanup(void) } /* ARGSUSED */ -_noreturn void +void handle_exit_timeout(_unused void *arg) { + int timeout; + syslog(LOG_ERR, "timed out"); - exit(EXIT_FAILURE); + if (!(options & DHCPCD_TIMEOUT_IPV4LL)) + exit(EXIT_FAILURE); + options &= ~DHCPCD_TIMEOUT_IPV4LL; + timeout = (PROBE_NUM * PROBE_MAX) + PROBE_WAIT + 1; + syslog(LOG_WARNING, "allowing %d seconds for IPv4LL timeout", timeout); + add_timeout_sec(timeout, handle_exit_timeout, NULL); } void @@ -1766,6 +1773,8 @@ main(int argc, char **argv) { 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); diff --git a/if-options.h b/if-options.h index ee40f8a8..209a9df3 100644 --- a/if-options.h +++ b/if-options.h @@ -71,6 +71,7 @@ #define DHCPCD_BACKGROUND (1 << 22) #define DHCPCD_VENDORRAW (1 << 23) #define DHCPCD_WAITIP (1 << 24) +#define DHCPCD_TIMEOUT_IPV4LL (1 << 25) extern const struct option cf_options[];