Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Sync with the ipv4 code and call ifp->if_output...



details:   https://anonhg.NetBSD.org/src/rev/377fea716765
branches:  trunk
changeset: 796116:377fea716765
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue May 20 20:23:56 2014 +0000

description:
Sync with the ipv4 code and call ifp->if_output() with KERNEL_LOCK
held.
Problem reported and fix tested by njoly@ on current-users@

diffstat:

 sys/netinet6/ip6_flow.c |   7 ++++---
 sys/netinet6/nd6.c      |  12 ++++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (68 lines):

diff -r bd9c1ab0a6f0 -r 377fea716765 sys/netinet6/ip6_flow.c
--- a/sys/netinet6/ip6_flow.c   Tue May 20 19:53:50 2014 +0000
+++ b/sys/netinet6/ip6_flow.c   Tue May 20 20:23:56 2014 +0000
@@ -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 @@
 
        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;
 }
 
diff -r bd9c1ab0a6f0 -r 377fea716765 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Tue May 20 19:53:50 2014 +0000
+++ b/sys/netinet6/nd6.c        Tue May 20 20:23:56 2014 +0000
@@ -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 @@
                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)



Home | Main Index | Thread Index | Old Index