Module Name: src Committed By: roy Date: Sun Apr 12 12:13:52 UTC 2020
Modified Files: src/sys/netinet6: nd6.c Log Message: nd6: RTM_MISS reports RTA_AUTHOR once more Just moves the logic to send RTM_MISS after the ICMP6 report as we rely on that function to extract the requesting address. Fixes PR kern/55164. To generate a diff of this commit: cvs rdiff -u -r1.268 -r1.269 src/sys/netinet6/nd6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.268 src/sys/netinet6/nd6.c:1.269 --- src/sys/netinet6/nd6.c:1.268 Fri Apr 3 14:04:27 2020 +++ src/sys/netinet6/nd6.c Sun Apr 12 12:13:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.268 2020/04/03 14:04:27 christos Exp $ */ +/* $NetBSD: nd6.c,v 1.269 2020/04/12 12:13:52 roy Exp $ */ /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.268 2020/04/03 14:04:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.269 2020/04/12 12:13:52 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -458,12 +458,11 @@ nd6_llinfo_timer(void *arg) struct ifnet *ifp; struct nd_ifinfo *ndi = NULL; bool send_ns = false; - struct in6_addr mdaddr6 = zeroin6_addr; const struct in6_addr *daddr6 = NULL; const struct in6_addr *taddr6 = &ln->r_l3addr.addr6; struct sockaddr_in6 dsin6, tsin6; - struct sockaddr *sa; struct mbuf *m = NULL; + bool missed = false; SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE(); @@ -493,6 +492,9 @@ nd6_llinfo_timer(void *arg) break; } + missed = true; + sockaddr_in6_init(&tsin6, taddr6, 0, 0, 0); + if (ln->ln_hold) { struct mbuf *m0; @@ -508,15 +510,6 @@ nd6_llinfo_timer(void *arg) clear_llinfo_pqueue(ln); } - sockaddr_in6_init(&tsin6, taddr6, 0, 0, 0); - if (!IN6_IS_ADDR_UNSPECIFIED(&mdaddr6)) { - sockaddr_in6_init(&dsin6, &mdaddr6, 0, 0, 0); - sa = sin6tosa(&dsin6); - } else - sa = NULL; - - rt_clonedmsg(RTM_MISS, sa, sin6tosa(&tsin6), NULL, ifp); - /* * Move to the ND6_LLINFO_WAITDELETE state for another * interval at which point the llentry will be freed @@ -586,9 +579,19 @@ out: if (ln != NULL) LLE_FREE_LOCKED(ln); SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE(); - if (m) { - icmp6_error2(m, ICMP6_DST_UNREACH, - ICMP6_DST_UNREACH_ADDR, 0, ifp, &mdaddr6); + if (missed) { + struct in6_addr mdaddr6 = zeroin6_addr; + struct sockaddr *sa; + + if (m != NULL) + icmp6_error2(m, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_ADDR, 0, ifp, &mdaddr6); + if (!IN6_IS_ADDR_UNSPECIFIED(&mdaddr6)) { + sockaddr_in6_init(&dsin6, &mdaddr6, 0, 0, 0); + sa = sin6tosa(&dsin6); + } else + sa = NULL; + rt_clonedmsg(RTM_MISS, sa, sin6tosa(&tsin6), NULL, ifp); } }