Module Name: src Committed By: bouyer Date: Tue May 20 20:23:56 UTC 2014
Modified Files: src/sys/netinet6: ip6_flow.c nd6.c Log Message: Sync with the ipv4 code and call ifp->if_output() with KERNEL_LOCK held. Problem reported and fix tested by njoly@ on current-users@ To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/netinet6/ip6_flow.c cvs rdiff -u -r1.149 -r1.150 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/ip6_flow.c diff -u src/sys/netinet6/ip6_flow.c:1.22 src/sys/netinet6/ip6_flow.c:1.23 --- src/sys/netinet6/ip6_flow.c:1.22 Tue Apr 1 13:11:44 2014 +++ src/sys/netinet6/ip6_flow.c Tue May 20 20:23:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_flow.c,v 1.22 2014/04/01 13:11:44 pooka Exp $ */ +/* $NetBSD: ip6_flow.c,v 1.23 2014/05/20 20:23:56 bouyer Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.22 2014/04/01 13:11:44 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.23 2014/05/20 20:23:56 bouyer Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -308,13 +308,14 @@ ip6flow_fastforward(struct mbuf **mp) ip6f->ip6f_uses++; + KERNEL_LOCK(1, NULL); /* Send on its way - straight to the interface output routine. */ if ((error = (*rt->rt_ifp->if_output)(rt->rt_ifp, m, dst, rt)) != 0) { ip6f->ip6f_dropped++; } else { ip6f->ip6f_forwarded++; } - + KERNEL_UNLOCK_ONE(NULL); return 1; } Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.149 src/sys/netinet6/nd6.c:1.150 --- src/sys/netinet6/nd6.c:1.149 Sat May 17 20:44:24 2014 +++ src/sys/netinet6/nd6.c Tue May 20 20:23:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.149 2014/05/17 20:44:24 rmind Exp $ */ +/* $NetBSD: nd6.c,v 1.150 2014/05/20 20:23:56 bouyer 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.149 2014/05/17 20:44:24 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.150 2014/05/20 20:23:56 bouyer Exp $"); #include "opt_ipsec.h" @@ -2257,9 +2257,13 @@ nd6_output(struct ifnet *ifp, struct ifn goto bad; } + KERNEL_LOCK(1, NULL); if ((ifp->if_flags & IFF_LOOPBACK) != 0) - return (*ifp->if_output)(origifp, m, sin6tocsa(dst), rt); - return (*ifp->if_output)(ifp, m, sin6tocsa(dst), rt); + error = (*ifp->if_output)(origifp, m, sin6tocsa(dst), rt); + else + error = (*ifp->if_output)(ifp, m, sin6tocsa(dst), rt); + KERNEL_UNLOCK_ONE(NULL); + return error; bad: if (m != NULL)