diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2005-02-21 21:58:17 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2005-02-21 21:58:17 +0000 |
commit | 0daccb9c9439393cb1c83104717ab7e0e4db26b0 (patch) | |
tree | 485f480fc21fe953c9c79e4896f5536a96968c9f /sys/netinet/tcp_usrreq.c | |
parent | f94ec97d48eb40559e5cda1aeeeaaf47fa4fcaee (diff) | |
download | src-test2-0daccb9c9439393cb1c83104717ab7e0e4db26b0.tar.gz src-test2-0daccb9c9439393cb1c83104717ab7e0e4db26b0.zip |
Notes
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index d6824dd9151a..e5ddf5885a66 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -302,10 +302,15 @@ tcp_usr_listen(struct socket *so, struct thread *td) const int inirw = INI_WRITE; COMMON_START(); - if (inp->inp_lport == 0) + SOCK_LOCK(so); + error = solisten_proto_check(so); + if (error == 0 && inp->inp_lport == 0) error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred); - if (error == 0) + if (error == 0) { tp->t_state = TCPS_LISTEN; + solisten_proto(so); + } + SOCK_UNLOCK(so); COMMON_END(PRU_LISTEN); } @@ -319,14 +324,19 @@ tcp6_usr_listen(struct socket *so, struct thread *td) const int inirw = INI_WRITE; COMMON_START(); - if (inp->inp_lport == 0) { + SOCK_LOCK(so); + error = solisten_proto_check(so); + if (error == 0 && inp->inp_lport == 0) { inp->inp_vflag &= ~INP_IPV4; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) inp->inp_vflag |= INP_IPV4; error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred); } - if (error == 0) + if (error == 0) { tp->t_state = TCPS_LISTEN; + solisten_proto(so); + } + SOCK_UNLOCK(so); COMMON_END(PRU_LISTEN); } #endif /* INET6 */ |