Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit c7d13c8

Browse files
yuchungchengdavem330
authored andcommitted
tcp: properly track retry time on passive Fast Open
This patch addresses a corner issue on timeout behavior of a passive Fast Open socket. A passive Fast Open server may write and close the socket when it is re-trying SYN-ACK to complete the handshake. After the handshake is completely, the server does not properly stamp the recovery start time (tp->retrans_stamp is 0), and the socket may abort immediately on the very first FIN timeout, instead of retying until it passes the system or user specified limit. Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Neal Cardwell <[email protected]> Reviewed-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7ae1897 commit c7d13c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/ipv4/tcp_timer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
378378
struct inet_connection_sock *icsk = inet_csk(sk);
379379
int max_retries = icsk->icsk_syn_retries ? :
380380
sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
381+
struct tcp_sock *tp = tcp_sk(sk);
381382
struct request_sock *req;
382383

383384
req = tcp_sk(sk)->fastopen_rsk;
@@ -395,6 +396,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
395396
inet_rtx_syn_ack(sk, req);
396397
req->num_timeout++;
397398
icsk->icsk_retransmits++;
399+
if (!tp->retrans_stamp)
400+
tp->retrans_stamp = tcp_time_stamp(tp);
398401
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
399402
TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
400403
}

0 commit comments

Comments
 (0)