From: Roy Marples Date: Thu, 29 Aug 2019 18:04:21 +0000 (+0100) Subject: BSD: Listen for Router -> Host messages via RTM_CHANGE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ffda995b68dee8bfa6781b4724da1750fb6c3c8;p=thirdparty%2Fdhcpcd.git BSD: Listen for Router -> Host messages via RTM_CHANGE If there is a lladdr in the gateway address then the node has become reachable. If there is no lladdr in the gateway address then the node is no longer a router. Unreachable is sent via RTM_DELETE and we ignore the initial RTM_ADD without a lladdr. --- diff --git a/src/if-bsd.c b/src/if-bsd.c index 83a2f169..ed5041d5 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1087,9 +1087,17 @@ if_rtm(struct dhcpcd_ctx *ctx, const struct rt_msghdr *rtm) */ if (rt.rt_dest.sa_family == AF_INET6 && rt.rt_flags & RTF_HOST && - (rtm->rtm_type == RTM_DELETE || rt.rt_dflags & RTDF_GATELINK)) - ipv6nd_neighbour(ctx, &rt.rt_ss_dest.sin6.sin6_addr, - rtm->rtm_type != RTM_DELETE ? IPV6ND_REACHABLE : 0); + !(rtm->rtm_type == RTM_ADD && !(rt.rt_dflags & RTDF_GATELINK))) + { + int flags = 0; + + if (rt.rt_dflags & RTDF_GATELINK) + flags |= IPV6ND_ROUTER; + if (rtm->rtm_type != RTM_DELETE) + flags |= IPV6ND_REACHABLE; + + ipv6nd_neighbour(ctx, &rt.rt_ss_dest.sin6.sin6_addr, flags); + } #endif rt_recvrt(rtm->rtm_type, &rt, rtm->rtm_pid);