summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_fw2.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-04-20 00:21:54 +0000
committerrwatson <rwatson@FreeBSD.org>2008-04-20 00:21:54 +0000
commit475838228befd0e9dc448f0e6db920483d471ace (patch)
tree1fcfbb3ee5c99f57f95b033d08da73ca3b91e11d /sys/netinet/ip_fw2.c
parentfb58e231cabae8a34169c9c9cc7cd781b527f980 (diff)
downloadFreeBSD-src-475838228befd0e9dc448f0e6db920483d471ace.zip
FreeBSD-src-475838228befd0e9dc448f0e6db920483d471ace.tar.gz
Teach pf and ipfw to use read locks in inpcbs write than write locks
when reading credential data from sockets. Teach pf to unlock the pcbinfo more quickly once it has acquired an inpcb lock, as the inpcb lock is sufficient to protect the reference. Assert locks, rather than read locks or write locks, on inpcbs in subroutines--this is necessary as the inpcb may be passed down with a write lock from the protocol, or may be passed down with a read lock from the firewall lookup routine, and either is sufficient. MFC after: 3 months
Diffstat (limited to 'sys/netinet/ip_fw2.c')
-rw-r--r--sys/netinet/ip_fw2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c
index 428a182..39baa71 100644
--- a/sys/netinet/ip_fw2.c
+++ b/sys/netinet/ip_fw2.c
@@ -1974,7 +1974,7 @@ check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif,
* up the PCB, we can use the one that was supplied.
*/
if (inp && *lookup == 0) {
- INP_WLOCK_ASSERT(inp);
+ INP_LOCK_ASSERT(inp);
if (inp->inp_socket != NULL) {
fill_ugid_cache(inp, ugp);
*lookup = 1;
@@ -2008,12 +2008,12 @@ check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif,
dst_ip, htons(dst_port),
wildcard, NULL);
if (pcb != NULL) {
- INP_WLOCK(pcb);
+ INP_RLOCK(pcb);
if (pcb->inp_socket != NULL) {
fill_ugid_cache(pcb, ugp);
*lookup = 1;
}
- INP_WUNLOCK(pcb);
+ INP_RUNLOCK(pcb);
}
INP_INFO_RUNLOCK(pi);
if (*lookup == 0) {
OpenPOWER on IntegriCloud