summaryrefslogtreecommitdiffstats
path: root/sys/netkey
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-05-20 05:41:09 +0000
committertanimura <tanimura@FreeBSD.org>2002-05-20 05:41:09 +0000
commit92d8381dd544a8237b3fd68c4e7fce9bd0903fb2 (patch)
tree2465ddbcecac65f96c5c6d5cef1a4fe3f1ac03f8 /sys/netkey
parent969293170b27461145f69a538d5abd15fea34ba1 (diff)
downloadFreeBSD-src-92d8381dd544a8237b3fd68c4e7fce9bd0903fb2.zip
FreeBSD-src-92d8381dd544a8237b3fd68c4e7fce9bd0903fb2.tar.gz
Lock down a socket, milestone 1.
o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
Diffstat (limited to 'sys/netkey')
-rw-r--r--sys/netkey/keysock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c
index 68f1045..c69af30 100644
--- a/sys/netkey/keysock.c
+++ b/sys/netkey/keysock.c
@@ -174,7 +174,9 @@ key_sendup0(rp, m, promisc)
error = ENOBUFS;
} else
error = 0;
+ SOCK_LOCK(rp->rcb_socket);
sorwakeup(rp->rcb_socket);
+ SOCK_UNLOCK(rp->rcb_socket);
return error;
}
@@ -427,8 +429,10 @@ key_attach(struct socket *so, int proto, struct thread *td)
key_cb.any_count++;
kp->kp_raw.rcb_laddr = &key_src;
kp->kp_raw.rcb_faddr = &key_dst;
- soisconnected_locked(so);
+ SOCK_LOCK(so);
+ soisconnected(so);
so->so_options |= SO_USELOOPBACK;
+ SOCK_UNLOCK(so);
splx(s);
return 0;
OpenPOWER on IntegriCloud