linux/tools/testing/selftests/net/packetdrill/tcp_dsack_mult.pkt
Eric Dumazet 8cc8d749dc selftests/net: packetdrill: add tcp_dsack_mult.pkt
Test DSACK behavior with non contiguous ranges.

Without prior fix (tcp: fix tcp_ofo_queue() to avoid including
too much DUP SACK range) this would fail with:

tcp_dsack_mult.pkt:37: error handling packet: bad value outbound TCP option 5
script packet:  0.100682 . 1:1(0) ack 6001 <nop,nop,sack 1001:3001 7001:8001>
actual packet:  0.100679 . 1:1(0) ack 6001 win 1097 <nop,nop,sack 1001:6001 7001:8001>

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: xin.guo <guoxin0309@gmail.com>
Link: https://patch.msgid.link/20250626123420.1933835-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-06-27 15:35:03 -07:00

46 lines
1.3 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0
// Test various DSACK (RFC 2883) behaviors.
--mss=1000
`./defaults.sh`
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+.1 < . 1:1(0) ack 1 win 1024
+0 accept(3, ..., ...) = 4
// First SACK range.
+0 < P. 1001:2001(1000) ack 1 win 1024
+0 > . 1:1(0) ack 1 <nop, nop, sack 1001:2001>
// Check SACK coalescing (contiguous sequence).
+0 < P. 2001:3001(1000) ack 1 win 1024
+0 > . 1:1(0) ack 1 <nop,nop,sack 1001:3001>
// Check we have two SACK ranges for non contiguous sequences.
+0 < P. 4001:5001(1000) ack 1 win 1024
+0 > . 1:1(0) ack 1 <nop,nop,sack 4001:5001 1001:3001>
// Three ranges.
+0 < P. 7001:8001(1000) ack 1 win 1024
+0 > . 1:1(0) ack 1 <nop,nop,sack 7001:8001 4001:5001 1001:3001>
// DSACK (1001:3001) + SACK (6001:7001)
+0 < P. 1:6001(6000) ack 1 win 1024
+0 > . 1:1(0) ack 6001 <nop,nop,sack 1001:3001 7001:8001>
// DSACK (7001:8001)
+0 < P. 6001:8001(2000) ack 1 win 1024
+0 > . 1:1(0) ack 8001 <nop,nop,sack 7001:8001>
// DSACK for an older segment.
+0 < P. 1:1001(1000) ack 1 win 1024
+0 > . 1:1(0) ack 8001 <nop,nop,sack 1:1001>