Skip to content

Commit

Permalink
tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics()
Browse files Browse the repository at this point in the history
We need to set tp->snd_ssthresh to TCP_INFINITE_SSTHRESH
in the case tcp_get_metrics() fails for some reason.

Fixes: 9ad7c04 ("tcp: RFC2988bis + taking RTT sample from 3WHS for the passive open side")
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Acked-by: Neal Cardwell <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Eric Dumazet authored and Paolo Abeni committed Oct 3, 2023
1 parent cbc3a15 commit 0814800
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions net/ipv4/tcp_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ void tcp_init_metrics(struct sock *sk)
u32 val, crtt = 0; /* cached RTT scaled by 8 */

sk_dst_confirm(sk);
/* ssthresh may have been reduced unnecessarily during.
* 3WHS. Restore it back to its initial default.
*/
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
if (!dst)
goto reset;

Expand All @@ -489,11 +493,6 @@ void tcp_init_metrics(struct sock *sk)
tp->snd_ssthresh = val;
if (tp->snd_ssthresh > tp->snd_cwnd_clamp)
tp->snd_ssthresh = tp->snd_cwnd_clamp;
} else {
/* ssthresh may have been reduced unnecessarily during.
* 3WHS. Restore it back to its initial default.
*/
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
}
val = tcp_metric_get(tm, TCP_METRIC_REORDERING);
if (val && tp->reordering != val)
Expand Down

0 comments on commit 0814800

Please sign in to comment.