From: Roy Marples Date: Tue, 24 Nov 2020 10:30:08 +0000 (+0000) Subject: DHCP: If error adding the address in oneshot, exit with failure X-Git-Tag: v9.3.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ca5bffd2de92ee21ea733cb0b2716a0a975942d;p=thirdparty%2Fdhcpcd.git DHCP: If error adding the address in oneshot, exit with failure Otherwise we loop. It's unlikely oneshot would be used with IPv6 due to addresses having lifetimes. --- diff --git a/src/dhcp.c b/src/dhcp.c index fdfd8b3d..86fe3e11 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -2365,8 +2365,15 @@ dhcp_bind(struct interface *ifp) } /* Add the address */ - if (ipv4_applyaddr(ifp) == NULL) + if (ipv4_applyaddr(ifp) == NULL) { + /* There was an error adding the address. + * If we are in oneshot, exit with a failure. */ + if (ctx->options & DHCPCD_ONESHOT) { + loginfox("exiting due to oneshot"); + eloop_exit(ctx->eloop, EXIT_FAILURE); + } return; + } /* Close the BPF filter as we can now receive DHCP messages * on a UDP socket. */