[PATCH net-next 7/7] selftests/net: packetdrill: add test for SO_RCVLOWAT window clamp

From: Simon Baatz via B4 Relay

Date: Wed Apr 08 2026 - 17:51:33 EST


From: Simon Baatz <gmbnomis@xxxxxxxxx>

Add a packetdrill test to verify that setting SO_RCVLOWAT does not
raise window_clamp beyond the maximum value allowed by window
scaling.

Signed-off-by: Simon Baatz <gmbnomis@xxxxxxxxx>
---
.../net/packetdrill/tcp_rcv_sockopt_lowat.pkt | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_lowat.pkt b/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_lowat.pkt
new file mode 100644
index 0000000000000..c024f3953f5a4
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_rcv_sockopt_lowat.pkt
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Verify that setting SO_RCVLOWAT does not set window_clamp higher than the
+// maximum value allowed by window scaling.
+--mss=1000
+
+`./defaults.sh`
+
+// Initialize connection
+ 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
+ +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 // TCP_WINDOW_CLAMP == 10
+ +0 setsockopt(4, SOL_SOCKET, SO_RCVLOWAT, [1024000], 4) = 0
+ +0 getsockopt(4, SOL_SOCKET, SO_RCVLOWAT, [1024000], [4]) = 0
+ +0 getsockopt(4, IPPROTO_TCP, 10, [65535], [4]) = 0

--
2.53.0