Mercurial > hg > dhcpcd
changeset 3711:6621bedf1ee1 draft
When deactivating an interface, set the carrier to unknown as it's no longer being tracked.
Thanks to Koichi Okamoto.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 28 Jul 2016 13:10:20 +0000 |
| parents | f740c77d4de7 |
| children | f4312ad1ff8c |
| files | dhcpcd.c if.c |
| diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dhcpcd.c Thu Jul 28 10:58:22 2016 +0000 +++ b/dhcpcd.c Thu Jul 28 13:10:20 2016 +0000 @@ -397,6 +397,8 @@ /* De-activate the interface */ ifp->active = IF_INACTIVE; ifp->options->options &= ~DHCPCD_STOPPING; + /* Set the link state to unknown as we're no longer tracking it. */ + ifp->carrier = LINK_UNKNOWN; stop: if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST))) @@ -1047,8 +1049,10 @@ for (i = 0; i < ctx->ifc; i++) if (strcmp(ctx->ifv[i], ifname) == 0) break; - if (i >= ctx->ifc) + if (i >= ctx->ifc) { ifp->active = IF_INACTIVE; + ifp->carrier = LINK_UNKNOWN; + } } i = 0;
--- a/if.c Thu Jul 28 10:58:22 2016 +0000 +++ b/if.c Thu Jul 28 13:10:20 2016 +0000 @@ -346,7 +346,6 @@ ifp->ctx = ctx; strlcpy(ifp->name, spec.devname, sizeof(ifp->name)); ifp->flags = ifa->ifa_flags; - ifp->carrier = if_carrier(ifp); if (ifa->ifa_addr != NULL) { #ifdef AF_LINK @@ -516,6 +515,10 @@ #endif ifp->active = active; + if (ifp->active) + ifp->carrier = if_carrier(ifp); + else + ifp->carrier = LINK_UNKNOWN; TAILQ_INSERT_TAIL(ifs, ifp, next); }
