]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tcp: do not increment BeyondWindow MIB for old seq
authorPaolo Abeni <pabeni@redhat.com>
Mon, 21 Jul 2025 17:20:22 +0000 (19:20 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 23 Jul 2025 01:21:15 +0000 (18:21 -0700)
The mentioned MIB is currently incremented even when a packet
with an old sequence number (i.e. a zero window probe) is received,
which is IMHO misleading.

Explicitly restrict such MIB increment at the relevant events.

Fixes: 6c758062c64d ("tcp: add LINUX_MIB_BEYOND_WINDOW")
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Link: https://patch.msgid.link/20d147292eb4b13b6535e0ad6f56be64d9c330d3.1753118029.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_input.c

index 81b6d37708120632d16a50892442ea04779cc3a4..71b76e98371a667b6e8263b32c242363672d7c5a 100644 (file)
@@ -5915,7 +5915,11 @@ step1:
                if (!th->rst) {
                        if (th->syn)
                                goto syn_challenge;
-                       NET_INC_STATS(sock_net(sk), LINUX_MIB_BEYOND_WINDOW);
+
+                       if (reason == SKB_DROP_REASON_TCP_INVALID_SEQUENCE ||
+                           reason == SKB_DROP_REASON_TCP_INVALID_END_SEQUENCE)
+                               NET_INC_STATS(sock_net(sk),
+                                             LINUX_MIB_BEYOND_WINDOW);
                        if (!tcp_oow_rate_limited(sock_net(sk), skb,
                                                  LINUX_MIB_TCPACKSKIPPEDSEQ,
                                                  &tp->last_oow_ack_time))