summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-05-31 11:52:35 +0000
committertanimura <tanimura@FreeBSD.org>2002-05-31 11:52:35 +0000
commite6fa9b9e922913444c2e6b2b58bf3de5eaed868d (patch)
tree9d5f24794525313566896ab89aa860515db344a6 /sys/netinet/raw_ip.c
parent1ea6cbb8c29088e04528460633798a6c131ca1ba (diff)
downloadFreeBSD-src-e6fa9b9e922913444c2e6b2b58bf3de5eaed868d.zip
FreeBSD-src-e6fa9b9e922913444c2e6b2b58bf3de5eaed868d.tar.gz
Back out my lats commit of locking down a socket, it conflicts with hsu's work.
Requested by: hsu
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index aaeb61c..86915fc 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -153,16 +153,9 @@ rip_input(m, off)
} else
#endif /*IPSEC*/
if (n) {
- if (last->inp_flags & INP_CONTROLOPTS)
- ip_savecontrol(last, &opts, ip, n);
- else {
- SOCK_LOCK(last->inp_socket);
- if(last->inp_socket->so_options & SO_TIMESTAMP) {
- SOCK_UNLOCK(last->inp_socket);
- ip_savecontrol(last, &opts, ip, n);
- } else
- SOCK_UNLOCK(last->inp_socket);
- }
+ if (last->inp_flags & INP_CONTROLOPTS ||
+ last->inp_socket->so_options & SO_TIMESTAMP)
+ ip_savecontrol(last, &opts, ip, n);
if (sbappendaddr(&last->inp_socket->so_rcv,
(struct sockaddr *)&ripsrc, n,
opts) == 0) {
@@ -170,11 +163,8 @@ rip_input(m, off)
m_freem(n);
if (opts)
m_freem(opts);
- } else {
- SOCK_LOCK(last->inp_socket);
+ } else
sorwakeup(last->inp_socket);
- SOCK_UNLOCK(last->inp_socket);
- }
opts = 0;
}
}
@@ -190,26 +180,16 @@ rip_input(m, off)
} else
#endif /*IPSEC*/
if (last) {
- if (last->inp_flags & INP_CONTROLOPTS)
+ if (last->inp_flags & INP_CONTROLOPTS ||
+ last->inp_socket->so_options & SO_TIMESTAMP)
ip_savecontrol(last, &opts, ip, m);
- else {
- SOCK_LOCK(last->inp_socket);
- if (last->inp_socket->so_options & SO_TIMESTAMP) {
- SOCK_UNLOCK(last->inp_socket);
- ip_savecontrol(last, &opts, ip, m);
- } else
- SOCK_UNLOCK(last->inp_socket);
- }
if (sbappendaddr(&last->inp_socket->so_rcv,
(struct sockaddr *)&ripsrc, m, opts) == 0) {
m_freem(m);
if (opts)
m_freem(opts);
- } else {
- SOCK_LOCK(last->inp_socket);
+ } else
sorwakeup(last->inp_socket);
- SOCK_UNLOCK(last->inp_socket);
- }
} else {
m_freem(m);
ipstat.ips_noproto++;
@@ -229,11 +209,8 @@ rip_output(m, so, dst)
{
register struct ip *ip;
register struct inpcb *inp = sotoinpcb(so);
- int flags;
+ int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
- SOCK_LOCK(so);
- flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
- SOCK_UNLOCK(so);
/*
* If the user handed us a complete IP packet, use it.
* Otherwise, allocate an mbuf for a header and fill it in.
@@ -531,21 +508,15 @@ rip_detach(struct socket *so)
static int
rip_abort(struct socket *so)
{
- SOCK_LOCK(so);
soisdisconnected(so);
- SOCK_UNLOCK(so);
return rip_detach(so);
}
static int
rip_disconnect(struct socket *so)
{
- SOCK_LOCK(so);
- if ((so->so_state & SS_ISCONNECTED) == 0) {
- SOCK_UNLOCK(so);
+ if ((so->so_state & SS_ISCONNECTED) == 0)
return ENOTCONN;
- }
- SOCK_UNLOCK(so);
return rip_abort(so);
}
@@ -581,9 +552,7 @@ rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
(addr->sin_family != AF_IMPLINK))
return EAFNOSUPPORT;
inp->inp_faddr = addr->sin_addr;
- SOCK_LOCK(so);
soisconnected(so);
- SOCK_UNLOCK(so);
return 0;
}
@@ -601,16 +570,13 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct inpcb *inp = sotoinpcb(so);
register u_long dst;
- SOCK_LOCK(so);
if (so->so_state & SS_ISCONNECTED) {
- SOCK_UNLOCK(so);
if (nam) {
m_freem(m);
return EISCONN;
}
dst = inp->inp_faddr.s_addr;
} else {
- SOCK_UNLOCK(so);
if (nam == NULL) {
m_freem(m);
return ENOTCONN;
OpenPOWER on IntegriCloud