Skip to content

Commit bc9f38c

Browse files
yuchungchengdavem330
authored andcommitted
tcp: avoid unconditional congestion window undo on SYN retransmit
Previously if an active TCP open has SYN timeout, it always undo the cwnd upon receiving the SYNACK. This is because tcp_clean_rtx_queue would reset tp->retrans_stamp when SYN is acked, which fools then tcp_try_undo_loss and tcp_packet_delayed. Addressing this issue is required to properly support undo for spurious SYN timeout. Fixing this is tricky -- for active TCP open tp->retrans_stamp records the time when the handshake starts, not the first retransmission time as the name may suggest. The simplest fix is for tcp_packet_delayed to ensure it is valid before comparing with other timestamp. One side effect of this change is active TCP Fast Open that incurred SYN timeout. Upon receiving a SYN-ACK that only acknowledged the SYN, it would immediately retransmit unacknowledged data in tcp_ack() because the data is marked lost after SYN timeout. But the retransmission would have an incorrect ack sequence number since rcv_nxt has not been updated yet tcp_rcv_synsent_state_process(), the retransmission needs to properly handed by tcp_rcv_fastopen_synack() like before. Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6d1474a commit bc9f38c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/tcp_input.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ static bool tcp_skb_spurious_retrans(const struct tcp_sock *tp,
22522252
*/
22532253
static inline bool tcp_packet_delayed(const struct tcp_sock *tp)
22542254
{
2255-
return !tp->retrans_stamp ||
2255+
return tp->retrans_stamp &&
22562256
tcp_tsopt_ecr_before(tp, tp->retrans_stamp);
22572257
}
22582258

@@ -3521,7 +3521,7 @@ static void tcp_xmit_recovery(struct sock *sk, int rexmit)
35213521
{
35223522
struct tcp_sock *tp = tcp_sk(sk);
35233523

3524-
if (rexmit == REXMIT_NONE)
3524+
if (rexmit == REXMIT_NONE || sk->sk_state == TCP_SYN_SENT)
35253525
return;
35263526

35273527
if (unlikely(rexmit == 2)) {

0 commit comments

Comments
 (0)