Mercurial > hg > dhcpcd
diff src/ipv4ll.c @ 5535:a0d828e25482 draft
Add --noconfigure option
With this set dhcpcd will not configure anything on the host.
The expectation is that a 3rd party script will instead.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 04 Nov 2020 14:18:48 +0000 |
| parents | 30603cb789ea |
| children | 4fe5c2a71254 |
line wrap: on
line diff
--- a/src/ipv4ll.c Wed Nov 04 11:31:40 2020 +1300 +++ b/src/ipv4ll.c Wed Nov 04 14:18:48 2020 +0000 @@ -228,6 +228,8 @@ #endif loginfox("%s: using IPv4LL address %s", ifp->name, inet_ntoa(state->pickedaddr)); + if (!(ifp->options->options & DHCPCD_CONFIGURE)) + goto run; if (ia == NULL) { if (ifp->ctx->options & DHCPCD_TEST) goto test; @@ -252,6 +254,7 @@ return; } rt_build(ifp->ctx, AF_INET); +run: astate = arp_announceaddr(ifp->ctx, &ia->addr); if (astate != NULL) astate->announced_cb = ipv4ll_announced_arp; @@ -281,7 +284,8 @@ struct ipv4ll_state *state = IPV4LL_STATE(ifp); ipv4ll_freearp(ifp); - ipv4_deladdr(state->addr, 1); + if (ifp->options->options & DHCPCD_CONFIGURE) + ipv4_deladdr(state->addr, 1); state->addr = NULL; rt_build(ifp->ctx, AF_INET); script_runreason(ifp, "IPV4LL"); @@ -373,7 +377,8 @@ if (ia != NULL && ia->addr_flags & IN_IFF_DUPLICATED) { state->pickedaddr = ia->addr; /* So it's not picked again. */ repick = true; - ipv4_deladdr(ia, 0); + if (ifp->options->options & DHCPCD_CONFIGURE) + ipv4_deladdr(ia, 0); ia = NULL; } #endif @@ -431,7 +436,8 @@ state = IPV4LL_STATE(ifp); if (state && state->addr != NULL) { - ipv4_deladdr(state->addr, 1); + if (ifp->options->options & DHCPCD_CONFIGURE) + ipv4_deladdr(state->addr, 1); state->addr = NULL; dropped = true; } @@ -442,7 +448,8 @@ TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) { if (IN_LINKLOCAL(ntohl(ia->addr.s_addr))) { - ipv4_deladdr(ia, 0); + if (ifp->options->options & DHCPCD_CONFIGURE) + ipv4_deladdr(ia, 0); dropped = true; } } @@ -534,7 +541,8 @@ else if (ia->addr_flags & IN_IFF_DUPLICATED) { logerrx("%s: DAD detected %s", ifp->name, ia->saddr); ipv4ll_freearp(ifp); - ipv4_deladdr(ia, 1); + if (ifp->options->options & DHCPCD_CONFIGURE) + ipv4_deladdr(ia, 1); state->addr = NULL; rt_build(ifp->ctx, AF_INET); ipv4ll_found(ifp);
