summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-10-08 19:56:52 +0000
committerRoy Marples <roy@marples.name>2009-10-08 19:56:52 +0000
commitf19df563b046a25ef610ba6960eabdb72dae49a7 (patch)
tree48472a6010b22a509b505b0b39b4677b2179205d /dhcpcd.c
parent26071224a25bd9e536ec0c2683d1c3f2cad683d7 (diff)
downloaddhcpcd-f19df563b046a25ef610ba6960eabdb72dae49a7.tar.xz
Add an extra timeout for IPv4LL when in use.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c13
1 files changed, 11 insertions, 2 deletions
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);