1// SPDX-License-Identifier: GPL-2.0 2// Test rwnd limited time in tcp_info for client side. 3 4`./defaults.sh` 5 6// Create a socket and set it to non-blocking. 7 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 8 +0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) 9 +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 10 11 +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) 12 +0 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8> 13 14// Server advertises 0 receive window. 15 +.01 < S. 0:0(0) ack 1 win 0 <mss 1000,nop,nop,sackOK> 16 17 +0 > . 1:1(0) ack 1 18 +0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 19 +0 fcntl(3, F_SETFL, O_RDWR) = 0 // set back to blocking 20 21// Make sure that initial rwnd limited time is 0. 22 +0 %{ assert tcpi_rwnd_limited == 0, tcpi_rwnd_limited }% 23 24// Receive window limited time starts here. 25 +0 write(3, ..., 1000) = 1000 26 27// Check that rwnd limited time in tcp_info is around 0.1s. 28 +.1 %{ assert 98000 <= tcpi_rwnd_limited <= 110000, tcpi_rwnd_limited }% 29 30// Server opens the receive window. 31 +.1 < . 1:1(0) ack 1 win 2000 32 33// Check that rwnd limited time in tcp_info is around 0.2s. 34 +0 %{ assert 198000 <= tcpi_rwnd_limited <= 210000, tcpi_rwnd_limited }% 35 36 +0 > P. 1:1001(1000) ack 1 37 38// Server advertises a very small receive window. 39 +.03 < . 1:1(0) ack 1001 win 10 40 41// Receive window limited time starts again. 42 +0 write(3, ..., 1000) = 1000 43 44// Server opens the receive window again. 45 +.1 < . 1:1(0) ack 1001 win 2000 46// Check that rwnd limited time in tcp_info is around 0.3s 47// and busy time is 0.3 + 0.03 (server opened small window temporarily). 48 +0 %{ assert 298000 <= tcpi_rwnd_limited <= 310000, tcpi_rwnd_limited;\ 49 assert 328000 <= tcpi_busy_time <= 340000, tcpi_busy_time;\ 50}% 51 52 +0 > P. 1001:2001(1000) ack 1 53 +.02 < . 1:1(0) ack 2001 win 2000 54 +0 %{ assert 348000 <= tcpi_busy_time <= 360000, tcpi_busy_time }% 55