diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index eb7f4e2db028..c674f8a94101 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.258 2019/08/22 21:14:46 roy Exp $ */ +/* $NetBSD: nd6.c,v 1.259 2019/08/22 21:22:50 roy Exp $ */ /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.258 2019/08/22 21:14:46 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.259 2019/08/22 21:22:50 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1192,6 +1192,7 @@ nd6_free(struct llentry *ln, int gc) struct nd_defrouter *dr; struct ifnet *ifp; struct in6_addr *in6; + struct sockaddr_in6 sin6; KASSERT(ln != NULL); LLE_WLOCK_ASSERT(ln); @@ -1293,6 +1294,10 @@ nd6_free(struct llentry *ln, int gc) LLE_WLOCK(ln); } + sockaddr_in6_init(&sin6, in6, 0, 0, 0); + rt_clonedmsg(RTM_DELETE, sin6tosa(&sin6), + (const uint8_t *)&ln->ll_addr, ifp); + /* * Save to unlock. We still hold an extra reference and will not * free(9) in llentry_free() if someone else holds one as well. @@ -2225,11 +2230,13 @@ nd6_cache_lladdr( break; } -#if 0 - /* XXX should we send rtmsg as it used to be? */ - if (do_update) - rt_newmsg(RTM_CHANGE, rt); /* tell user process */ -#endif + if (do_update) { + struct sockaddr_in6 sin6; + + sockaddr_in6_init(&sin6, from, 0, 0, 0); + rt_clonedmsg(is_newentry ? RTM_ADD : RTM_CHANGE, + sin6tosa(&sin6), lladdr, ifp); + } if (ln != NULL) { router = ln->ln_router; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index dd8194a7268d..679e5d2687a9 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.166 2019/04/29 16:12:30 roy Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.167 2019/08/22 21:22:50 roy Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.166 2019/04/29 16:12:30 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.167 2019/08/22 21:22:50 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -883,11 +883,13 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) */ ln->ln_asked = 0; nd6_llinfo_release_pkts(ln, ifp); - /* FIXME */ -#if 0 - if (rt_announce) /* tell user process about any new lladdr */ - rt_newmsg(RTM_CHANGE, rt); -#endif + + if (rt_announce) { + struct sockaddr_in6 sin6; + + sockaddr_in6_init(&sin6, &taddr6, 0, 0, 0); + rt_clonedmsg(RTM_CHANGE, sin6tosa(&sin6), lladdr, ifp); + } freeit: if (ln != NULL)