summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-11-24 10:30:08 +0000
committerRoy Marples <roy@marples.name>2020-11-24 10:30:08 +0000
commit3ca5bffd2de92ee21ea733cb0b2716a0a975942d (patch)
tree0338f4bd537d03644e7df7bb82e2bb24784078f1
parent7c1f6fe6343e3d3be8eb29ce7400f81f4b15df38 (diff)
downloaddhcpcd-3ca5bffd2de92ee21ea733cb0b2716a0a975942d.tar.xz
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.
-rw-r--r--src/dhcp.c9
1 files changed, 8 insertions, 1 deletions
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. */