diff options
| author | Roy Marples <roy@marples.name> | 2018-03-15 20:31:14 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2018-03-15 20:31:14 +0000 |
| commit | 81edfe77f1ab8c5e9d5761fda73506d2a28710fb (patch) | |
| tree | a7e3c54929c984a645505fabdea491fc08941557 /src/ipv6nd.c | |
| parent | 3715c0a1b3fbb92dd08d07d5f6e8f3afa833ff0d (diff) | |
| download | dhcpcd-81edfe77f1ab8c5e9d5761fda73506d2a28710fb.tar.xz | |
ipv6nd: simplify reachable
Diffstat (limited to 'src/ipv6nd.c')
| -rw-r--r-- | src/ipv6nd.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 3fca8848..5ce2a3ad 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -377,25 +377,26 @@ static void 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 @@ ipv6nd_handlena(struct dhcpcd_ctx *ctx, struct interface *ifp, 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 |
