Mercurial > hg > dhcpcd
changeset 5549:6d72dc67a984 draft
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.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 24 Nov 2020 10:30:08 +0000 |
| parents | bcca2ff28a64 |
| children | dba7608e00b3 |
| files | src/dhcp.c |
| diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dhcp.c Mon Nov 23 13:22:20 2020 +0000 +++ b/src/dhcp.c Tue Nov 24 10:30:08 2020 +0000 @@ -2365,8 +2365,15 @@ } /* 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. */
