From 9e4a4f3fcfa59f2146efcec3a2e56be645f0a1c6 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 8 May 2025 17:26:52 +0100 Subject: [PATCH] dhcpcd: fork to background on initial timeout Unless the -1, --oneshot option is given. dhcpcd should keep on trying to configure the interface. Fixes #423 --- src/dhcpcd.8.in | 15 ++++++++------- src/dhcpcd.c | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/dhcpcd.8.in b/src/dhcpcd.8.in index 83f6399d..66818b3a 100644 --- a/src/dhcpcd.8.in +++ b/src/dhcpcd.8.in @@ -522,18 +522,19 @@ option instead. Timeout after .Ar seconds , instead of the default 30. +On timeout, +.Nm +will exit if the +.Fl 1 , +.Fl Fl oneshot +option has been given, +otherwise it will fork into the background and keep on +trying. A setting of 0 .Ar seconds causes .Nm to wait forever to get a lease. -If -.Nm -is working on a single interface then -.Nm -will exit when a timeout occurs, otherwise -.Nm -will fork into the background. .It Fl u , Fl Fl userclass Ar class Tags the DHCPv4 message with the userclass .Ar class . diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 1f0fabb6..3e65141e 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -198,7 +198,7 @@ handle_exit_timeout(void *arg) ctx = arg; logerrx("timed out"); - if (!(ctx->options & DHCPCD_MANAGER)) { + if (ctx->options & DHCPCD_ONESHOT) { struct interface *ifp; TAILQ_FOREACH(ifp, ctx->ifaces, next) { -- 2.47.3