From: Roy Marples Date: Tue, 22 Nov 2011 23:44:32 +0000 (+0000) Subject: Change default reboot timeout to 5 seconds. X-Git-Tag: v5.5.0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=499225e43fdd093c6bc0c9f37ffb25cd5af97cb1;p=thirdparty%2Fdhcpcd.git Change default reboot timeout to 5 seconds. When rebooting and we haven't daemonised, reduce the discover timeout to allow for fallback or IPv4LL addresses. --- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index f6813b7e..6af4fcdb 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 9, 2011 +.Dd November 22, 2011 .Dt DHCPCD 8 SMM .Os .Sh NAME @@ -352,7 +352,7 @@ then waits until this process has exited. Allow .Ar reboot seconds before moving to the discover phase if we have an old lease to use. -The default is 10 seconds. +The default is 5 seconds. A setting of 0 seconds causes .Nm to skip the reboot phase and go straight into discover. diff --git a/dhcpcd.c b/dhcpcd.c index 11d96d45..97ad6c6e 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -208,7 +208,7 @@ handle_exit_timeout(_unused void *arg) exit(EXIT_FAILURE); } options &= ~DHCPCD_TIMEOUT_IPV4LL; - timeout = (PROBE_NUM * PROBE_MAX) + PROBE_WAIT + 1; + timeout = (PROBE_NUM * PROBE_MAX) + (PROBE_WAIT * 2); syslog(LOG_WARNING, "allowing %d seconds for IPv4LL timeout", timeout); add_timeout_sec(timeout, handle_exit_timeout, NULL); } @@ -915,19 +915,31 @@ start_discover(void *arg) { struct interface *iface = arg; struct if_options *ifo = iface->state->options; + int timeout = ifo->timeout; + + /* If we're rebooting and we're not daemonised then we need + * to shorten the normal timeout to ensure we try correctly + * for a fallback or IPv4LL address. */ + if (iface->state->state == DHS_REBOOT && + !(options & DHCPCD_DAEMONISED)) + { + timeout -= ifo->reboot; + if (timeout <= 0) + timeout = 2; + } iface->state->state = DHS_DISCOVER; iface->state->xid = dhcp_xid(iface); delete_timeout(NULL, iface); if (ifo->fallback) - add_timeout_sec(ifo->timeout, start_fallback, iface); + add_timeout_sec(timeout, start_fallback, iface); else if (ifo->options & DHCPCD_IPV4LL && !IN_LINKLOCAL(htonl(iface->addr.s_addr))) { if (IN_LINKLOCAL(htonl(iface->state->fail.s_addr))) add_timeout_sec(RATE_LIMIT_INTERVAL, start_ipv4ll, iface); else - add_timeout_sec(ifo->timeout, start_ipv4ll, iface); + add_timeout_sec(timeout, start_ipv4ll, iface); } if (ifo->options & DHCPCD_REQUEST) syslog(LOG_INFO, "%s: broadcasting for a lease (requesting %s)", diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index c3bfa8f8..0c6ec693 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006-2010 Roy Marples +.\" Copyright (c) 2006-2011 Roy Marples .\" All rights reserved .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 28, 2010 +.Dd November 22, 2011 .Dt DHCPCD.CONF 5 SMM .Os .Sh NAME @@ -203,7 +203,7 @@ Suppress any dhcpcd output to the console, except for errors. Allow .Ar reboot seconds before moving to the discover phase if we have an old lease to use. -The default is 10 seconds. +The default is 5 seconds. A setting if 0 seconds causes .Nm dhcpcd to skip the reboot phase and go straight into discover. diff --git a/if-options.h b/if-options.h index 241cb4d2..9fcb64bd 100644 --- a/if-options.h +++ b/if-options.h @@ -40,7 +40,7 @@ #define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLO:Q:S:TUVW:X:Z:" #define DEFAULT_TIMEOUT 30 -#define DEFAULT_REBOOT 10 +#define DEFAULT_REBOOT 5 #define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */ #define VENDORCLASSID_MAX_LEN 255