summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_pcb.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-07-27 23:44:03 +0000
committerrwatson <rwatson@FreeBSD.org>2004-07-27 23:44:03 +0000
commit558dee61de1ee0a98a05f904cbbdd76b04daef79 (patch)
treeda198faf6490ff3d454a432a6e7e16fea898717e /sys/netinet6/in6_pcb.c
parent3675ec98e8fbe871084ec3871ca2f42ca8acac1a (diff)
downloadFreeBSD-src-558dee61de1ee0a98a05f904cbbdd76b04daef79.zip
FreeBSD-src-558dee61de1ee0a98a05f904cbbdd76b04daef79.tar.gz
Commit a first pass at in6pcb and pcbinfo locking for IPv6,
synchronizing IPv6 protocol control blocks and lists. These changes are modeled on the inpcb locking for IPv4, submitted by Jennifer Yang, and committed by Jeffrey Hsu. With these locking changes, IPv6 use of inpcbs is now substantially more MPSAFE, and permits IPv4 inpcb locking assertions to be run in the presence of IPv6 compiled into the kernel.
Diffstat (limited to 'sys/netinet6/in6_pcb.c')
-rw-r--r--sys/netinet6/in6_pcb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 8a66e4f..7627c11 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -130,6 +130,9 @@ in6_pcbbind(inp, nam, cred)
u_short lport = 0;
int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
+ INP_INFO_WLOCK_ASSERT(pcbinfo);
+ INP_LOCK_ASSERT(inp);
+
if (!in6_ifaddr) /* XXX broken! */
return (EADDRNOTAVAIL);
if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
@@ -304,6 +307,9 @@ in6_pcbladdr(inp, nam, plocal_addr6)
if (sin6->sin6_port == 0)
return (EADDRNOTAVAIL);
+ INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
+ INP_LOCK_ASSERT(inp);
+
/* KAME hack: embed scopeid */
if (in6_embedscope(&sin6->sin6_addr, sin6, inp, &ifp) != 0)
return EINVAL;
@@ -356,6 +362,9 @@ in6_pcbconnect(inp, nam, cred)
register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
int error;
+ INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
+ INP_LOCK_ASSERT(inp);
+
/*
* Call inner routine, to assign local interface address.
* in6_pcbladdr() may automatically fill in sin6_scope_id.
@@ -402,6 +411,10 @@ void
in6_pcbdisconnect(inp)
struct inpcb *inp;
{
+
+ INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
+ INP_LOCK_ASSERT(inp);
+
bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr));
inp->inp_fport = 0;
/* clear flowinfo - draft-itojun-ipv6-flowlabel-api-00 */
@@ -421,6 +434,9 @@ in6_pcbdetach(inp)
struct socket *so = inp->inp_socket;
struct inpcbinfo *ipi = inp->inp_pcbinfo;
+ INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
+ INP_LOCK_ASSERT(inp);
+
#if defined(IPSEC) || defined(FAST_IPSEC)
if (inp->in6p_sp != NULL)
ipsec6_delete_pcbpolicy(inp);
OpenPOWER on IntegriCloud