NetBSD/sys/netipsec
gdt 0c9c715c58 Fix FAST_IPSEC locking violation.
Without this change, using ESP tunnels with FAST_IPSEC on a 2-cpu i386
machine results in an mbuf leak.  This change was tested in netbsd-6.

When FAST_IPSEC is enabled and a tunnel is set up, after the
outer packet is stripped off, FAST_IPSEC queues the inner
packet on the appropriate queue (ipinstrq or ip6instrq).
These queues require the KERNEL_LOCK to be held before
using the queue, and the FAST_IPSEC code did not take the
KERNEL_LOCK as required.
KERNEL_LOCK and KERNEL_UNLOCK_ONE calls have been added.

If a struct ifnet instance is passed to the if_handoff
function which does this queuing, the interface's
if_start function may be called.  Some hardware devices
require KERNEL_LOCK to be held; others do not.  Looking
at the body of NetBSD code, other places where an if_start
function is called, KERNEL_LOCK is held.  Thus, the lock is
not released in if_handoff until after the if_start function
is called.  In practice, having the kernel lock when
if_start is called makes no difference - there is not
a single instance in all of the NetBSD code where
if_handoff is passed an instance of struct ifnet.

This commit is the work of Bev Schwartz of BBN.

Approved for Public Release, Distribution Unlimited
This material is based upon work supported by the Defense Advanced Research
Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
Contract No. N66001-09-C-2073.
2013-05-09 19:21:50 +00:00
..
ah_var.h
ah.h
esp_var.h
esp.h
files.netipsec remove KAME IPSEC, replaced by FAST_IPSEC 2012-03-22 20:34:37 +00:00
ipcomp_var.h
ipcomp.h
ipip_var.h
ipsec6.h
ipsec_input.c After IPSEC input processing, pass a decoded/authenticated IPv4 packet 2012-01-25 21:58:10 +00:00
ipsec_mbuf.c
ipsec_netbsd.c Add some pre-processor magic to verify that the type of the data item 2012-06-02 21:36:41 +00:00
ipsec_osdep.h Fix FAST_IPSEC locking violation. 2013-05-09 19:21:50 +00:00
ipsec_output.c add patch from Arnaud Degroote to handle IPv6 extended options with 2012-01-10 20:01:56 +00:00
ipsec_private.h
ipsec_var.h
ipsec.c rename pcb_sp to policy to avoid: 2012-12-07 15:29:38 +00:00
ipsec.h more IPSEC header cleanup: don't install unneeded headers to userland, 2012-01-06 14:17:10 +00:00
key_debug.c
key_debug.h
key_var.h
key.c Fix whitespace (mostly removing trailing). 2012-09-20 23:50:05 +00:00
key.h
keydb.h g/c unused struct member 2012-08-29 20:37:50 +00:00
keysock.c
keysock.h
Makefile more IPSEC header cleanup: don't install unneeded headers to userland, 2012-01-06 14:17:10 +00:00
xform_ah.c Add "consttime_bcmp" and "explicit_bzero" functions for both kernel 2012-08-30 12:16:48 +00:00
xform_esp.c Add "consttime_bcmp" and "explicit_bzero" functions for both kernel 2012-08-30 12:16:48 +00:00
xform_ipcomp.c Make sure the mbufs in the input path (only the parts which we are going 2012-01-25 20:31:23 +00:00
xform_ipip.c
xform_tcp.c fix build in the (FAST_)IPSEC & TCP_SIGNATURE case 2012-01-11 14:39:08 +00:00
xform.h