diff options
| author | Julien Charbon <jch@FreeBSD.org> | 2015-05-15 12:35:18 +0000 |
|---|---|---|
| committer | Julien Charbon <jch@FreeBSD.org> | 2015-05-15 12:35:18 +0000 |
| commit | 8502895c6af7e3b7edf61d103308f703b1801cb7 (patch) | |
| tree | f71c85dc3f8b770a594d021c27b082733307f339 | |
| parent | c89ab180624b70cf1b520c07c86b927a707d4df2 (diff) | |
Notes
| -rw-r--r-- | sys/netinet/tcp_usrreq.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 8d92803b5ee7..be9e0e761478 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -475,8 +475,12 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { - error = EINVAL; + if (inp->inp_flags & INP_TIMEWAIT) { + error = EADDRINUSE; + goto out; + } + if (inp->inp_flags & INP_DROPPED) { + error = ECONNREFUSED; goto out; } tp = intotcpcb(inp); @@ -522,8 +526,12 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { - error = EINVAL; + if (inp->inp_flags & INP_TIMEWAIT) { + error = EADDRINUSE; + goto out; + } + if (inp->inp_flags & INP_DROPPED) { + error = ECONNREFUSED; goto out; } tp = intotcpcb(inp); |
