diff options
author | tanimura <tanimura@FreeBSD.org> | 2002-05-31 11:52:35 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2002-05-31 11:52:35 +0000 |
commit | e6fa9b9e922913444c2e6b2b58bf3de5eaed868d (patch) | |
tree | 9d5f24794525313566896ab89aa860515db344a6 /sys/netinet/udp_usrreq.c | |
parent | 1ea6cbb8c29088e04528460633798a6c131ca1ba (diff) | |
download | FreeBSD-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/udp_usrreq.c')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 1522966..af4769f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -319,12 +319,8 @@ udp_input(m, off) * port. It * assumes that an application will never * clear these options after setting them. */ - SOCK_LOCK(last->inp_socket); - if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0) { - SOCK_UNLOCK(last->inp_socket); + if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0) break; - } else - SOCK_UNLOCK(last->inp_socket); } if (last == NULL) { @@ -388,10 +384,8 @@ udp_input(m, off) */ udp_in.sin_port = uh->uh_sport; udp_in.sin_addr = ip->ip_src; - SOCK_LOCK(inp->inp_socket); if (inp->inp_flags & INP_CONTROLOPTS || inp->inp_socket->so_options & SO_TIMESTAMP) { - SOCK_UNLOCK(inp->inp_socket); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) { int savedflags; @@ -404,8 +398,7 @@ udp_input(m, off) } else #endif ip_savecontrol(inp, &opts, ip, m); - } else - SOCK_UNLOCK(inp->inp_socket); + } m_adj(m, iphlen + sizeof(struct udphdr)); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) { @@ -418,9 +411,7 @@ udp_input(m, off) udpstat.udps_fullsock++; goto bad; } - SOCK_LOCK(inp->inp_socket); sorwakeup(inp->inp_socket); - SOCK_UNLOCK(inp->inp_socket); return; bad: m_freem(m); @@ -462,10 +453,8 @@ udp_append(last, ip, n, off) struct sockaddr *append_sa; struct mbuf *opts = 0; - SOCK_LOCK(last->inp_socket); if (last->inp_flags & INP_CONTROLOPTS || last->inp_socket->so_options & SO_TIMESTAMP) { - SOCK_UNLOCK(last->inp_socket); #ifdef INET6 if (last->inp_vflag & INP_IPV6) { int savedflags; @@ -481,8 +470,7 @@ udp_append(last, ip, n, off) } else #endif ip_savecontrol(last, &opts, ip, n); - } else - SOCK_UNLOCK(last->inp_socket); + } #ifdef INET6 if (last->inp_vflag & INP_IPV6) { if (udp_in6.uin6_init_done == 0) { @@ -499,11 +487,8 @@ udp_append(last, ip, n, off) if (opts) m_freem(opts); udpstat.udps_fullsock++; - } else { - SOCK_LOCK(last->inp_socket); + } else sorwakeup(last->inp_socket); - SOCK_UNLOCK(last->inp_socket); - } } /* @@ -516,10 +501,8 @@ udp_notify(inp, errno) int errno; { inp->inp_socket->so_error = errno; - SOCK_LOCK(inp->inp_socket); sorwakeup(inp->inp_socket); sowwakeup(inp->inp_socket); - SOCK_UNLOCK(inp->inp_socket); } void @@ -695,7 +678,7 @@ udp_output(inp, m, addr, control, td) register int len = m->m_pkthdr.len; struct in_addr laddr; struct sockaddr_in *sin; - int s = 0, error = 0, soopts; + int s = 0, error = 0; if (control) m_freem(control); /* XXX */ @@ -776,11 +759,8 @@ udp_output(inp, m, addr, control, td) goto release; } #endif /*IPSEC*/ - SOCK_LOCK(inp->inp_socket); - soopts = inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST); - SOCK_UNLOCK(inp->inp_socket); error = ip_output(m, inp->inp_options, &inp->inp_route, - soopts, + (inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST)), inp->inp_moptions); if (addr) { @@ -819,9 +799,7 @@ udp_abort(struct socket *so) inp = sotoinpcb(so); if (inp == 0) return EINVAL; /* ??? possible? panic instead? */ - SOCK_LOCK(so); soisdisconnected(so); - SOCK_UNLOCK(so); s = splnet(); in_pcbdetach(inp); splx(s); @@ -886,11 +864,8 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr); error = in_pcbconnect(inp, nam, td); splx(s); - if (error == 0) { - SOCK_LOCK(so); + if (error == 0) soisconnected(so); - SOCK_UNLOCK(so); - } return error; } @@ -925,9 +900,7 @@ udp_disconnect(struct socket *so) in_pcbdisconnect(inp); inp->inp_laddr.s_addr = INADDR_ANY; splx(s); - SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */ - SOCK_UNLOCK(so); return 0; } |