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

Commit 2daffbd

Browse files
nealcardwellgregkh
authored andcommitted
tcp: fix TFO SYN_RECV to not zero retrans_stamp with retransmits out
[ Upstream commit 27c80ef ] Fix tcp_rcv_synrecv_state_fastopen() to not zero retrans_stamp if retransmits are outstanding. tcp_fastopen_synack_timer() sets retrans_stamp, so typically we'll need to zero retrans_stamp here to prevent spurious retransmits_timed_out(). The logic to zero retrans_stamp is from this 2019 commit: commit cd736d8 ("tcp: fix retrans timestamp on passive Fast Open") However, in the corner case where the ACK of our TFO SYNACK carried some SACK blocks that caused us to enter TCP_CA_Recovery then that non-zero retrans_stamp corresponds to the active fast recovery, and we need to leave retrans_stamp with its current non-zero value, for correct ETIMEDOUT and undo behavior. Fixes: cd736d8 ("tcp: fix retrans timestamp on passive Fast Open") Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 718c49f commit 2daffbd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/ipv4/tcp_input.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6554,10 +6554,17 @@ static void tcp_rcv_synrecv_state_fastopen(struct sock *sk)
65546554
if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss && !tp->packets_out)
65556555
tcp_try_undo_recovery(sk);
65566556

6557-
/* Reset rtx states to prevent spurious retransmits_timed_out() */
65586557
tcp_update_rto_time(tp);
6559-
tp->retrans_stamp = 0;
65606558
inet_csk(sk)->icsk_retransmits = 0;
6559+
/* In tcp_fastopen_synack_timer() on the first SYNACK RTO we set
6560+
* retrans_stamp but don't enter CA_Loss, so in case that happened we
6561+
* need to zero retrans_stamp here to prevent spurious
6562+
* retransmits_timed_out(). However, if the ACK of our SYNACK caused us
6563+
* to enter CA_Recovery then we need to leave retrans_stamp as it was
6564+
* set entering CA_Recovery, for correct retransmits_timed_out() and
6565+
* undo behavior.
6566+
*/
6567+
tcp_retrans_stamp_cleanup(sk);
65616568

65626569
/* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1,
65636570
* we no longer need req so release it.

0 commit comments

Comments
 (0)