From 87fad50310f2bd0dcc990e80e23b09768918cf5b Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 3 Jan 2015 17:44:01 +0100 Subject: Backport Linux changes for proper TCP EOF handling Notably when remote eagerly sends a RST: we want to return EOF to the application, not EPIPE. * pfinet/linux-src/net/ipv4/tcp_output.c (tcp_connect): Set sk->done to 0. * pfinet/linux-src/net/ipv4/tcp_input.c (tcp_fin): Set RCV_SHUTDOWN, and sk->done to 1. * pfinet/linux-src/net/ipv4/tcp.c (tcp_recv_urg): Only return ENOTCONN when we never actually connect. Always return 0 when reception is closed. (tcp_recvmsg): When any data is available, ignore errors and EOF. When no data is available, first check for reception being closed, then for errors. --- pfinet/linux-src/net/ipv4/tcp_output.c | 1 + 1 file changed, 1 insertion(+) (limited to 'pfinet/linux-src/net/ipv4/tcp_output.c') diff --git a/pfinet/linux-src/net/ipv4/tcp_output.c b/pfinet/linux-src/net/ipv4/tcp_output.c index 9ea4b7ad..a15b7b30 100644 --- a/pfinet/linux-src/net/ipv4/tcp_output.c +++ b/pfinet/linux-src/net/ipv4/tcp_output.c @@ -922,6 +922,7 @@ void tcp_connect(struct sock *sk, struct sk_buff *buff, int mtu) tp->rcv_nxt = 0; sk->err = 0; + sk->done = 0; /* We'll fix this up when we get a response from the other end. * See tcp_input.c:tcp_rcv_state_process case TCP_SYN_SENT. -- cgit v1.2.3