aboutsummaryrefslogtreecommitdiffstats
path: root/test/packetdrill/tests/linux/receiver_rtt/rcv-rtt-with-timestamps-new.pkt
blob: 2155f2126f2d8d228d50d537935433fe39bc5722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Test that receiver-side RTT estimation is sane when
// using TCP timestamps. We assert that the receive-side
// RTT estimate is between 95 and 105ms.

// Use a small receive buffer so that we advertise small windows, to keep the
// test short.
`sysctl -q net.ipv4.tcp_rmem="4096 10000 2097152"`

// Create a socket.
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0

// Verify that the receive buffer is the tcp_rmem default.
0.000 getsockopt(3, SOL_SOCKET, SO_RCVBUF, [10000], [4]) = 0

0.000 bind(3, ..., ...) = 0
0.000 listen(3, 1) = 0

// Establish a connection.
0.100 < S 0:0(0) win 20000 <mss 1000,sackOK,TS val 100 ecr 0>
0.100 > S. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 100>
0.200 < . 1:1(0) ack 1 win 20000 <nop,nop,TS val 200 ecr 100>
0.200 accept(3, ..., ...) = 4
0.200 %{ assert tcpi_rcv_rtt == 0 }%

// First flight.
0.200 < . 1:1001(1000) ack 1 win 20000 <nop,nop,TS val 200 ecr 100>
0.200 > . 1:1(0) ack 1001 <nop,nop,TS val 200 ecr 200>
0.200 < . 1001:2001(1000) ack 1 win 20000 <nop,nop,TS val 200 ecr 100>
0.200 > . 1:1(0) ack 2001 <nop,nop,TS val 200 ecr 200>
0.200 read(4, ..., 2000) = 2000
0.200 %{ assert tcpi_rcv_rtt >= 95*1000 and tcpi_rcv_rtt <= 105*1000 }%

// Second flight.
0.300 < . 2001:3001(1000) ack 1 win 20000 <nop,nop,TS val 300 ecr 200>
0.300 > . 1:1(0) ack 3001 <nop,nop,TS val 300 ecr 300>
0.300 < . 3001:4001(1000) ack 1 win 20000 <nop,nop,TS val 300 ecr 200>
0.300 > . 1:1(0) ack 4001 <nop,nop,TS val 300 ecr 300>
0.300 < . 4001:5001(1000) ack 1 win 20000 <nop,nop,TS val 300 ecr 200>
0.300 > . 1:1(0) ack 5001 <nop,nop,TS val 300 ecr 300>
0.300 < . 5001:6001(1000) ack 1 win 20000 <nop,nop,TS val 300 ecr 200>
0.300 read(4, ..., 4000) = 4000
0.300 > . 1:1(0) ack 6001 <nop,nop,TS val 300 ecr 300>
0.300 %{ assert tcpi_rcv_rtt >= 95*1000 and tcpi_rcv_rtt <= 105*1000 }%

// Third flight.
// We omit outgoing ACKs because we don't care about this behavior,
// and don't want to introduce dependencies on the receive window behavior.
0.400 < . 6001:7001(1000) ack 1 win 20000 <nop,nop,TS val 400 ecr 300>
0.400 < . 7001:8001(1000) ack 1 win 20000 <nop,nop,TS val 400 ecr 300>
0.400 < . 8001:9001(1000) ack 1 win 20000 <nop,nop,TS val 400 ecr 300>
0.400 < . 9001:10001(1000) ack 1 win 20000 <nop,nop,TS val 400 ecr 300>
0.400 < . 10001:11001(1000) ack 1 win 20000 <nop,nop,TS val 400 ecr 300>
0.400 read(4, ..., 5000) = 5000
0.400 %{ assert tcpi_rcv_rtt >= 95*1000 and tcpi_rcv_rtt <= 105*1000 }%

0.500 `sysctl -q net.ipv4.tcp_rmem="4096 87380 3732736"`