aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorPietro De Domenico <lynxes.exe@gmail.com>2026-11-12 16:56:44 +0100
committerStefano Brivio <sbrivio@redhat.com>2026-12-04 22:54:33 +0100
commit5e7a154aaaa8891afa007e111aed6d67f7680645 (patch)
tree340904d2cd205028593b42f6fc1dfaa2f0f5b3bf
parent1d3afa7c3a4532055bd841fcf669b89345557c87 (diff)
downloadpasst-5e7a154aaaa8891afa007e111aed6d67f7680645.tar
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.tar.gz
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.tar.bz2
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.tar.lz
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.tar.xz
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.tar.zst
passt-5e7a154aaaa8891afa007e111aed6d67f7680645.zip
tcp: Don't add peers to low RTT table before RTT is measured
The kernel initialises the minimum RTT of a socket to ~0U (see tcp_init_sock() and tcp_create_openreq_child()), and tcpi_min_rtt keeps that value until the first RTT sample. For a passively opened socket, the handshake gives no sample if the SYN-ACK was retransmitted (Karn's algorithm, see tcp_synack_rtt_meas()), and the only fallback is the timestamp echo, which isn't there if the peer didn't negotiate TCP timestamps. Windows clients don't, by default. tcp_rtt_dst_check() casts tcpi_min_rtt to int, so ~0U becomes -1, the peer passes the threshold check, and it's added to the low RTT table, which it never leaves: from then on, every connection with that peer advertises an unclamped window to the guest and stalls on retransmissions. Skip the check while the minimum RTT hasn't been measured yet. Reproduced on Linux 6.18.57 by dropping SYN-ACKs at a client with net.ipv4.tcp_timestamps set to 0, for two seconds: tcpi_min_rtt of the accepted socket is 0xffffffff, with tcpi_total_retrans 3, and pasta would have added the client to the table. Link: https://archives.passt.top/passt-dev/CAJPNJUuUYSkW776P0hKmweHnKOqXtsXqwm4HXP-+jorXrSfFFg@mail.gmail.com/ Suggested-by: Stefano Brivio <sbrivio@redhat.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Pietro De Domenico <lynxes.exe@gmail.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index 24425c8..5dca2b1 100644
--- a/tcp.c
+++ b/tcp.c
@@ -759,7 +759,8 @@ static void tcp_rtt_dst_check(const struct tcp_tap_conn *conn,
int i, hole = -1;
if (!min_rtt_cap ||
- (int)tinfo->tcpi_min_rtt > LOW_RTT_THRESHOLD)
+ (int)tinfo->tcpi_min_rtt > LOW_RTT_THRESHOLD ||
+ tinfo->tcpi_min_rtt == ~0U /* not measured yet */)
return;
for (i = 0; i < LOW_RTT_TABLE_SIZE; i++) {