summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2001-03-09 08:16:40 +0000
committerjlemon <jlemon@FreeBSD.org>2001-03-09 08:16:40 +0000
commit50bffc6c06aca836443e915bf84b611c97ee5c19 (patch)
tree62d7942d27fad82cda790598df2a606d5b543fee /sys/netinet/tcp_usrreq.c
parente8c0cc0af2cba10cc1a43be82ba2a811596cbf73 (diff)
downloadFreeBSD-src-50bffc6c06aca836443e915bf84b611c97ee5c19.zip
FreeBSD-src-50bffc6c06aca836443e915bf84b611c97ee5c19.tar.gz
Push the test for a disconnected socket when accept()ing down to the
protocol layer. Not all protocols behave identically. This fixes the brokenness observed with unix-domain sockets (and postfix)
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 1d64581..2b76f98 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -419,6 +419,10 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp;
+ if (so->so_state & SS_ISDISCONNECTED) {
+ error = ECONNABORTED;
+ goto out;
+ }
COMMON_START();
in_setpeeraddr(so, nam);
COMMON_END(PRU_ACCEPT);
@@ -433,6 +437,10 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp;
+ if (so->so_state & SS_ISDISCONNECTED) {
+ error = ECONNABORTED;
+ goto out;
+ }
COMMON_START();
in6_mapped_peeraddr(so, nam);
COMMON_END(PRU_ACCEPT);
OpenPOWER on IntegriCloud