Module Name:    src
Committed By:   martin
Date:           Fri Aug  4 14:38:09 UTC 2023

Modified Files:
        src/sys/netinet6 [netbsd-8]: in6.c ip6_output.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1884):

        sys/netinet6/in6.c: revision 1.289
        sys/netinet6/ip6_output.c: revision 1.234

in6: clear ND6_IFF_IFDISABLED to allow DAD again on link-up

in6: don't send any IPv6 packets over a disabled interface


To generate a diff of this commit:
cvs rdiff -u -r1.245.2.13 -r1.245.2.14 src/sys/netinet6/in6.c
cvs rdiff -u -r1.191.6.5 -r1.191.6.6 src/sys/netinet6/ip6_output.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/in6.c
diff -u src/sys/netinet6/in6.c:1.245.2.13 src/sys/netinet6/in6.c:1.245.2.14
--- src/sys/netinet6/in6.c:1.245.2.13	Thu Oct  8 18:06:13 2020
+++ src/sys/netinet6/in6.c	Fri Aug  4 14:38:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $	*/
+/*	$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.14 2023/08/04 14:38:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2311,6 +2311,10 @@ in6_if_link_down(struct ifnet *ifp)
 	}
 	pserialize_read_exit(s);
 	curlwp_bindx(bound);
+
+	/* Clear ND6_IFF_IFDISABLED to allow DAD again on link-up. */
+	if (ifp->if_afdata[AF_INET6] != NULL)
+		ND_IFINFO(ifp)->flags &= ~ND6_IFF_IFDISABLED;
 }
 
 void

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.191.6.5 src/sys/netinet6/ip6_output.c:1.191.6.6
--- src/sys/netinet6/ip6_output.c:1.191.6.5	Thu Mar 23 12:08:39 2023
+++ src/sys/netinet6/ip6_output.c	Fri Aug  4 14:38:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.191.6.5 2023/03/23 12:08:39 martin Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.191.6.6 2023/08/04 14:38:09 martin Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.191.6.5 2023/03/23 12:08:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.191.6.6 2023/08/04 14:38:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -197,6 +197,12 @@ ip6_if_output(struct ifnet * const ifp, 
 		}
 	}
 
+	/* discard the packet if IPv6 operation is disabled on the interface */
+	if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)) {
+		m_freem(m);
+		return ENETDOWN; /* better error? */
+	}
+
 	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
 		error = if_output_lock(ifp, origifp, m, sin6tocsa(dst), rt);
 	else

Reply via email to