> In tcp_input.c:tcp_rcv_state_process() first switch() statement, case
> TCP_SYN_SENT, in all cases if th->ack set and we fail (and return 1
> from this function) for some reason, we must do:
>
> sk->err = ECONNRESET;
> sk->state_change(sk);
>
> before returning 1 back (which will send the reset), this will wake up
> the person sleeping in inet_stream_connect() and notice the 3 way
> handshake failed.
OK, I made the changes and they really seem to improve the situation.
I have juste made a few 100s connections in a row without a single
hang. A patch against 2.1.98 is attached.
> Again, thanks again for the good bug reporting, I wish all were this
> easy to fix ;-)
Blush!
--- linux-2.1/net/ipv4/tcp_input.c.dist Sun Apr 19 19:59:21 1998
+++ linux-2.1/net/ipv4/tcp_input.c Mon Apr 27 16:56:38 1998
@@ -1901,6 +1901,8 @@
/* We got an ack, but it's not a good ack. */
if(!tcp_ack(sk,th, TCP_SKB_CB(skb)->seq,
TCP_SKB_CB(skb)->ack_seq, len)) {
+ sk->err = ECONNRESET;
+ sk->state_change(sk);
tcp_statistics.TcpAttemptFails++;
return 1;
}
@@ -1914,6 +1916,8 @@
/* A valid ack from a different connection
* start. Shouldn't happen but cover it.
*/
+ sk->err = ECONNRESET;
+ sk->state_change(sk);
tcp_statistics.TcpAttemptFails++;
return 1;
}
-- Thomas.Quinot@Cuivre.FR.EU.ORG <URL:http://Web.FdN.FR/~tquinot/>- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu