]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add an extra timeout for IPv4LL when in use.
authorRoy Marples <roy@marples.name>
Thu, 8 Oct 2009 19:56:52 +0000 (19:56 +0000)
committerRoy Marples <roy@marples.name>
Thu, 8 Oct 2009 19:56:52 +0000 (19:56 +0000)
dhcpcd.c
if-options.h

index cff3fde466457a19a7d76e451dbe170673d64ee8..535fa753e141ca1d96ab40f9f6fea8f28e47a132 100644 (file)
--- 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);
index ee40f8a84d224ae0bea9cbf25a1c35fea7c5ddcf..209a9df3875f05275644257da1bf2b3302b12c7c 100644 (file)
@@ -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[];