summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/udp6_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-04-22 12:20:33 +0000
committerrwatson <rwatson@FreeBSD.org>2008-04-22 12:20:33 +0000
commite51618e32187334d34fb1905d09bb110f703c72a (patch)
tree677fa27353c27c09082ab0fb904118df357b1aab /sys/netinet6/udp6_usrreq.c
parentd018fd8cf091bbcef0677a0e1dc626b35bebcfe3 (diff)
downloadFreeBSD-src-e51618e32187334d34fb1905d09bb110f703c72a.zip
FreeBSD-src-e51618e32187334d34fb1905d09bb110f703c72a.tar.gz
Acquire a read lock, rather than a write lock, on a UDPv6 inpcb when
delivering to the socket or extracting socket details for monitoring purposes. MFC after: 3 months
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
-rw-r--r--sys/netinet6/udp6_usrreq.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index b019ca7..161c274 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -129,7 +129,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
struct socket *so;
struct mbuf *opts;
- INP_WLOCK_ASSERT(inp);
+ INP_LOCK_ASSERT(inp);
#ifdef IPSEC
/* Check AH/ESP integrity. */
@@ -277,9 +277,9 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
struct mbuf *n;
if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
- INP_WLOCK(last);
+ INP_RLOCK(last);
udp6_append(last, n, off, &fromsa);
- INP_WUNLOCK(last);
+ INP_RUNLOCK(last);
}
}
last = inp;
@@ -306,9 +306,9 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
udpstat.udps_noportmcast++;
goto badheadlocked;
}
- INP_WLOCK(last);
+ INP_RLOCK(last);
udp6_append(last, m, off, &fromsa);
- INP_WUNLOCK(last);
+ INP_RUNLOCK(last);
INP_INFO_RUNLOCK(&udbinfo);
return (IPPROTO_DONE);
}
@@ -343,9 +343,9 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
return (IPPROTO_DONE);
}
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
udp6_append(inp, m, off, &fromsa);
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
INP_INFO_RUNLOCK(&udbinfo);
return (IPPROTO_DONE);
@@ -453,7 +453,7 @@ udp6_getcred(SYSCTL_HANDLER_ARGS)
INP_INFO_RUNLOCK(&udbinfo);
return (ENOENT);
}
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
if (inp->inp_socket == NULL) {
error = ENOENT;
goto out;
@@ -463,7 +463,7 @@ udp6_getcred(SYSCTL_HANDLER_ARGS)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
out:
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
INP_INFO_RUNLOCK(&udbinfo);
if (error == 0)
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
OpenPOWER on IntegriCloud