From: Simon Baatz <[email protected]> Add a packetdrill test to verify that the socket option TCP_WINDOW_CLAMP can be set to a large value on a listening socket, but is clamped on an established socket to the maximum representable advertised window.
Signed-off-by: Simon Baatz <[email protected]> --- .../net/packetdrill/tcp_rcv_sockopt_wnd_clamp.pkt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_wnd_clamp.pkt b/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_wnd_clamp.pkt new file mode 100644 index 0000000000000..d7203f2893c3f --- /dev/null +++ b/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_wnd_clamp.pkt @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Verify that TCP_WINDOW_CLAMP can be set to a high value on a LISTEN socket, but, +// in an established connection, the value is clamped to the maximum representable +// advertised window. +--mss=1000 + +`./defaults.sh` + +// Initialize connection + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 + +0 setsockopt(3, SOL_SOCKET, SO_RCVBUF, [256000], 4) = 0 + +0 setsockopt(3, IPPROTO_TCP, 10, [255999], 4) = 0 // TCP_WINDOW_CLAMP == 10 + +0 getsockopt(3, IPPROTO_TCP, 10, [255999], [4]) = 0 + +0 bind(3, ..., ...) = 0 + +0 listen(3, 1) = 0 + + +0 < S 0:0(0) win 32792 + +0 > S. 0:0(0) ack 1 win 65535 <mss 1460> + +0 < . 1:1(0) ack 1 win 32792 + + +0 accept(3, ..., ...) = 4 + + +0 getsockopt(4, IPPROTO_TCP, 10, [65535], [4]) = 0 + +0 setsockopt(4, IPPROTO_TCP, 10, [255999], 4) = 0 + +0 getsockopt(4, IPPROTO_TCP, 10, [65535], [4]) = 0 + +0 getsockopt(3, IPPROTO_TCP, 10, [255999], [4]) = 0 -- 2.53.0

