Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/netinet6 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/d9c333672d6c
branches:  netbsd-8
changeset: 451277:d9c333672d6c
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 13 09:04:38 2019 +0000

description:
Pull up following revision(s) (requested by roy in ticket #1262):

        sys/netinet6/nd6_nbr.c: revision 1.163

inet6: discard any received NA with a LL address we own

This matches ARP behaviour.

diffstat:

 sys/netinet6/nd6_nbr.c |  33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diffs (70 lines):

diff -r 25b971a4224f -r d9c333672d6c sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Sun May 12 09:23:50 2019 +0000
+++ b/sys/netinet6/nd6_nbr.c    Mon May 13 09:04:38 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.138.6.6 2018/04/02 08:54:35 martin Exp $ */
+/*     $NetBSD: nd6_nbr.c,v 1.138.6.7 2019/05/13 09:04:38 martin Exp $ */
 /*     $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.138.6.6 2018/04/02 08:54:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.138.6.7 2019/05/13 09:04:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -630,9 +630,26 @@
                goto freeit;
        }
 
-       if (ndopts.nd_opts_tgt_lladdr) {
+       if (ndopts.nd_opts_tgt_lladdr != NULL) {
+               struct ifnet *ifp_ll;
+               struct psref psref_ll;
+
                lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1);
                lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3;
+
+               if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
+                       nd6log(LOG_INFO, "lladdrlen mismatch for %s "
+                           "(if %d, NA packet %d)\n", IN6_PRINT(ip6buf, &taddr6),
+                           ifp->if_addrlen, lladdrlen - 2);
+                       goto bad;
+               }
+
+               ifp_ll = if_get_bylla(lladdr, ifp->if_addrlen, &psref_ll);
+               if (ifp_ll != NULL) {
+                       /* it's from me, ignore it. */
+                       if_put(ifp_ll, &psref_ll);
+                       goto freeit;
+               }
        }
 
        ifa = (struct ifaddr *)in6ifa_ifpwithaddr_psref(ifp, &taddr6, &psref_ia);
@@ -647,7 +664,8 @@
         * Otherwise, process as defined in RFC 2461.
         */
        if (ifa
-        && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE)) {
+        && (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE))
+       {
                nd6_dad_na_input(ifa);
                ifa_release(ifa, &psref_ia);
                ifa = NULL;
@@ -674,13 +692,6 @@
                goto bad;
        }
 
-       if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
-               nd6log(LOG_INFO, "lladdrlen mismatch for %s "
-                   "(if %d, NA packet %d)\n", IN6_PRINT(ip6buf, &taddr6),
-                   ifp->if_addrlen, lladdrlen - 2);
-               goto bad;
-       }
-
        /*
         * If no neighbor cache entry is found, NA SHOULD silently be
         * discarded.



Home | Main Index | Thread Index | Old Index