diff --git a/gtests/net/tcp/window_clamp/clamp-window-takes-effect.pkt b/gtests/net/tcp/window_clamp/clamp-window-takes-effect.pkt index 7effcfab..9daa5dc2 100644 --- a/gtests/net/tcp/window_clamp/clamp-window-takes-effect.pkt +++ b/gtests/net/tcp/window_clamp/clamp-window-takes-effect.pkt @@ -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 +