Message ID | 20100926191632.GB13046@1wt.eu |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
From: Willy Tarreau <w@1wt.eu> Date: Sun, 26 Sep 2010 21:16:32 +0200 > On Sun, Sep 26, 2010 at 07:40:15PM +0200, Willy Tarreau wrote: >> 3) when an ACK comes from the other side, either it's below our last >> seq, and we simply ignore it, just as if we were in TIME_WAIT, or >> it is equal to the last seq and indicates that it's now safe to >> reset ; we would then just send the RST to notify the other side >> that the data it sent were not read. The connection can then either >> be destroyed or put in TIME_WAIT. It's the point where the connection >> normally switches from FIN_WAIT1 to FIN_WAIT2, since the FIN has been >> acked. The only difference is that we don't need a FIN_WAIT2 state >> for an orphan. > > In fact, the following patch seems to provide the expected result : There is no way I'm applying this. Pending outgoing data means nothing, and not sending out the RST is wrong because there will be no notification to the peer that you decided to close and ignore the data stream the peer sent, and thus data was lost. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f1813bc..ee5fa5d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1879,7 +1880,7 @@ void tcp_close(struct sock *sk, long timeout) * advertise a zero window, then kill -9 the FTP client, wheee... * Note: timeout is always zero in such a case. */ - if (data_was_unread) { + if (data_was_unread && !tcp_sk(sk)->packets_out) { /* Unread data was tossed, zap the connection. */ NET_INC_STATS_USER(sock_net(sk), LINUX_MIB_TCPABORTONCLOSE); tcp_set_state(sk, TCP_CLOSE);