summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-08-03 19:29:47 +0000
committerrwatson <rwatson@FreeBSD.org>2005-08-03 19:29:47 +0000
commit7504160c1e1a408af3d9f6b998e6e9ce49dcf158 (patch)
tree7da6aeba14225658b424b8a1f07d30e9523cbc3e /sys/netinet/ip_output.c
parent405f9b654c12682dc78887f78db0d01ebe3acbdf (diff)
downloadFreeBSD-src-7504160c1e1a408af3d9f6b998e6e9ce49dcf158.zip
FreeBSD-src-7504160c1e1a408af3d9f6b998e6e9ce49dcf158.tar.gz
Introduce in_multi_mtx, which will protect IPv4-layer multicast address
lists, as well as accessor macros. For now, this is a recursive mutex due code sequences where IPv4 multicast calls into IGMP calls into ip_output(), which then tests for a multicast forwarding case. For support macros in in_var.h to check multicast address lists, assert that in_multi_mtx is held. Acquire in_multi_mtx around iteration over the IPv4 multicast address lists, such as in ip_input() and ip_output(). Acquire in_multi_mtx when manipulating the IPv4 layer multicast addresses, as well as over the manipulation of ifnet multicast address lists in order to keep the two layers in sync. Lock down accesses to IPv4 multicast addresses in IGMP, or assert the lock when performing IGMP join/leave events. Eliminate spl's associated with IPv4 multicast addresses, portions of IGMP that weren't previously expunged by IGMP locking. Add in_multi_mtx, igmp_mtx, and if_addr_mtx lock order to hard-coded lock order in WITNESS, in that order. Problem reported by: Ed Maste <emaste at phaedrus dot sandvine dot ca> MFC after: 10 days
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 0241479..0a43b2d 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -291,9 +291,11 @@ again:
ip->ip_src = IA_SIN(ia)->sin_addr;
}
+ IN_MULTI_LOCK();
IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm);
if (inm != NULL &&
(imo == NULL || imo->imo_multicast_loop)) {
+ IN_MULTI_UNLOCK();
/*
* If we belong to the destination multicast group
* on the outgoing interface, and the caller did not
@@ -302,6 +304,7 @@ again:
ip_mloopback(ifp, m, dst, hlen);
}
else {
+ IN_MULTI_UNLOCK();
/*
* If we are acting as a multicast router, perform
* multicast forwarding as if the packet had just
OpenPOWER on IntegriCloud