Skip to content

Commit

Permalink
packetdrill: add test of tcp window clamp socket option
Browse files Browse the repository at this point in the history
Modifies a test of TCP_WINDOW_CLAMP, including lowering, raising, and
lowering again the clamp while the connection is in progress to add
a test of brief lowering before raising.

Requires a patch to tcp_set_window_clamp discussed as "tcp: enable mid
stream window clamp".

Signed-off-by: Neil Spring <[email protected]>
  • Loading branch information
nspring committed Aug 25, 2021
1 parent b5ec022 commit 0d97599
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions gtests/net/tcp/window_clamp/clamp-window-takes-effect.pkt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,48 @@
// Read to clear the receive buffer, will not raise the window.
+.01 read(4, ..., 129000) = 128000

// Small data, just to check that the clamp remains.
// Raise briefly and lower the clamp to ensure the last write takes effect.
+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [1280000], 4) = 0
+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [128000], 4) = 0

// Small data, just to check that the clamp was raised; the increase
// opens in proportion to the amount of data sent to avoid epic burst
+.01 < . 640000:641000(1000) ack 1 win 320
+0 > . 1:1(0) ack 641000 win 50
+0 > . 1:1(0) ack 641000 win 62
+.01 < . 641000:643000(2000) ack 1 win 320
+0 > . 1:1(0) ack 643000 win 78
+.01 < . 643000:646000(3000) ack 1 win 320
+0 > . 1:1(0) ack 646000 win 101
+.01 < . 646000:704000(58000) ack 1 win 320
+0 > . 1:1(0) ack 704000 win 500

// Read to clear the receive buffer, will not raise the window.
+.01 read(4, ..., 129000) = 64000

// Lower briefly and return the clamp to ensure that the last write
// takes effect and that the window doesn't decrease unnecessarily.
// (It still increases slowly based on the volume of data received.)
+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [12800], 4) = 0
+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [256000], 4) = 0

+.01 < . 704000:705000(1000) ack 1 win 320
+0 > . 1:1(0) ack 705000 win 512
+.01 < . 705000:707000(2000) ack 1 win 320
+0 > . 1:1(0) ack 707000 win 528

+.01 < . 707000:768000(61000) ack 1 win 320
+0 > . 1:1(0) ack 768000 win 1000

+.01 read(4, ..., 129000) = 64000

// Repeat the transient drop, but include a small packet in between.
// The advertised window should return to the high value quickly,
// since the receiver never committed to a tiny window.
+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [12800], 4) = 0
+.01 < . 768000:769000(1000) ack 1 win 320
+0 > . 1:1(0) ack 769000 win 997

+0 setsockopt(4, IPPROTO_TCP, TCP_WINDOW_CLAMP, [256000], 4) = 0
+.01 < . 769000:770000(1000) ack 1 win 320
+0 > . 1:1(0) ack 770000 win 1000

0 comments on commit 0d97599

Please sign in to comment.