summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-08-29 19:04:21 +0100
committerRoy Marples <roy@marples.name>2019-08-29 19:04:21 +0100
commit4ffda995b68dee8bfa6781b4724da1750fb6c3c8 (patch)
tree64f405ddea8215575cf568c1bced83c89ce1916a /src/if-bsd.c
parent933e0df9ee7ae54807608555e1d41286d4253e25 (diff)
downloaddhcpcd-4ffda995b68dee8bfa6781b4724da1750fb6c3c8.tar.xz
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.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c14
1 files changed, 11 insertions, 3 deletions
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);