Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 nd6: RTM_MISS reports RTA_AUTHOR once more



details:   https://anonhg.NetBSD.org/src/rev/73193236f0fb
branches:  trunk
changeset: 971051:73193236f0fb
user:      roy <roy%NetBSD.org@localhost>
date:      Sun Apr 12 12:13:52 2020 +0000

description:
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.

diffstat:

 sys/netinet6/nd6.c |  35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diffs (81 lines):

diff -r f24109a87227 -r 73193236f0fb sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Sun Apr 12 08:51:41 2020 +0000
+++ b/sys/netinet6/nd6.c        Sun Apr 12 12:13:52 2020 +0000
@@ -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 @@
        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 @@
                        break;
                }
 
+               missed = true;
+               sockaddr_in6_init(&tsin6, taddr6, 0, 0, 0);
+
                if (ln->ln_hold) {
                        struct mbuf *m0;
 
@@ -508,15 +510,6 @@
                        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 @@
        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);
        }
 }
 



Home | Main Index | Thread Index | Old Index