]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Change default reboot timeout to 5 seconds.
authorRoy Marples <roy@marples.name>
Tue, 22 Nov 2011 23:44:32 +0000 (23:44 +0000)
committerRoy Marples <roy@marples.name>
Tue, 22 Nov 2011 23:44:32 +0000 (23:44 +0000)
When rebooting and we haven't daemonised, reduce the discover timeout
to allow for fallback or IPv4LL addresses.

dhcpcd.8.in
dhcpcd.c
dhcpcd.conf.5.in
if-options.h

index f6813b7ea2c3b9c0974c35a652a5ff547069357f..6af4fcdb4f0b325e76b4377b4ba355927ae9a594 100644 (file)
@@ -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.
index 11d96d454a1ac092fc22ff403d41e785e174a3f6..97ad6c6e8cf0c0b96ef23a8a7c961a7cf7fe073d 100644 (file)
--- 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)",
index c3bfa8f8e265cf8f24b00f898d2888875ab9416a..0c6ec6931bd20d4c24be9dd5657c2b09fd405f2f 100644 (file)
@@ -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.
index 241cb4d2060a8da5e124e0bbf258bd357eea0d30..9fcb64bd4ca391969856a43ae28ed18548f7c3b1 100644 (file)
@@ -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