Sync with the ipv4 code and call ifp->if_output() with KERNEL_LOCK

held.
Problem reported and fix tested by njoly@ on current-users@
This commit is contained in:
bouyer 2014-05-20 20:23:56 +00:00
parent 49165189ad
commit 8ec9289dda
2 changed files with 12 additions and 7 deletions

View File

@ -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;
}

View File

@ -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 ifnet *origifp, struct mbuf *m0,
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)