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