Mercurial > hg > dhcpcd
changeset 4234:56c1ab3b654e draft
ipv6nd: simplify reachable
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 15 Mar 2018 20:31:14 +0000 |
| parents | c2a1efc6b19a |
| children | 27bad70c0d9c |
| files | src/ipv6nd.c |
| diffstat | 1 files changed, 19 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ipv6nd.c Sat Mar 10 11:50:08 2018 +0000 +++ b/src/ipv6nd.c Thu Mar 15 20:31:14 2018 +0000 @@ -377,25 +377,26 @@ ipv6nd_reachable(struct ra *rap, int flags) { + if (rap->lifetime == 0) + return; + if (flags & IPV6ND_REACHABLE) { - if (rap->lifetime && rap->expired) { - loginfox("%s: %s is reachable again", - rap->iface->name, rap->sfrom); - rap->expired = 0; - rt_build(rap->iface->ctx, AF_INET6); - /* XXX Not really an RA */ - script_runreason(rap->iface, "ROUTERADVERT"); - } + if (rap->expired == 0) + return; + loginfox("%s: %s is reachable again", + rap->iface->name, rap->sfrom); + rap->expired = 0; } else { - if (rap->lifetime && !rap->expired) { - logwarnx("%s: %s is unreachable, expiring it", - rap->iface->name, rap->sfrom); - rap->expired = 1; - rt_build(rap->iface->ctx, AF_INET6); - /* XXX Not really an RA */ - script_runreason(rap->iface, "ROUTERADVERT"); - } + if (rap->expired != 0) + return; + logwarnx("%s: %s is unreachable, expiring it", + rap->iface->name, rap->sfrom); + rap->expired = 1; } + + rt_build(rap->iface->ctx, AF_INET6); + /* XXX Not really an RA */ + script_runreason(rap->iface, "ROUTERADVERT"); } void @@ -1505,15 +1506,8 @@ return; } - if (is_solicited && is_router && rap->lifetime) { - if (rap->expired) { - rap->expired = 0; - loginfox("%s: %s reachable (%s)", - ifp->name, taddr, ctx->sfrom); - rt_build(ifp->ctx, AF_INET6); - script_runreason(rap->iface, "ROUTERADVERT"); /* XXX */ - } - } + if (is_solicited && is_router && rap->lifetime) + ipv6nd_reachable(rap, IPV6ND_REACHABLE); } static void
