xref: /linux/tools/testing/selftests/net/packetdrill/tcp_limited_transmit_limited-transmit-sack.pkt (revision 0ad9617c78acbc71373fb341a6f75d4012b01d69)
1*5d4cadefSSoham Chakradeo// SPDX-License-Identifier: GPL-2.0
2*5d4cadefSSoham Chakradeo// Test RFC 3042 "Limited Transmit": "sending a new data segment in
3*5d4cadefSSoham Chakradeo// response to each of the first two duplicate acknowledgments that
4*5d4cadefSSoham Chakradeo// arrive at the sender".
5*5d4cadefSSoham Chakradeo// This variation tests a receiver that supports SACK.
6*5d4cadefSSoham Chakradeo
7*5d4cadefSSoham Chakradeo`./defaults.sh`
8*5d4cadefSSoham Chakradeo
9*5d4cadefSSoham Chakradeo// Establish a connection.
10*5d4cadefSSoham Chakradeo    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
11*5d4cadefSSoham Chakradeo   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
12*5d4cadefSSoham Chakradeo   +0 bind(3, ..., ...) = 0
13*5d4cadefSSoham Chakradeo   +0 listen(3, 1) = 0
14*5d4cadefSSoham Chakradeo
15*5d4cadefSSoham Chakradeo  +.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
16*5d4cadefSSoham Chakradeo   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
17*5d4cadefSSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 320
18*5d4cadefSSoham Chakradeo   +0 accept(3, ..., ...) = 4
19*5d4cadefSSoham Chakradeo
20*5d4cadefSSoham Chakradeo// Write some data, and send the initial congestion window.
21*5d4cadefSSoham Chakradeo   +0 write(4, ..., 15000) = 15000
22*5d4cadefSSoham Chakradeo   +0 > P. 1:10001(10000) ack 1
23*5d4cadefSSoham Chakradeo
24*5d4cadefSSoham Chakradeo// Limited transmit: on first dupack, send a new data segment.
25*5d4cadefSSoham Chakradeo +.11 < . 1:1(0) ack 1 win 320 <sack 1001:2001,nop,nop>
26*5d4cadefSSoham Chakradeo   +0 > . 10001:11001(1000) ack 1
27*5d4cadefSSoham Chakradeo
28*5d4cadefSSoham Chakradeo// Limited transmit: on second dupack, send a new data segment.
29*5d4cadefSSoham Chakradeo +.01 < . 1:1(0) ack 1 win 320 <sack 1001:3001,nop,nop>
30*5d4cadefSSoham Chakradeo   +0 > . 11001:12001(1000) ack 1
31*5d4cadefSSoham Chakradeo
32*5d4cadefSSoham Chakradeo// It turned out to be reordering, not loss.
33*5d4cadefSSoham Chakradeo +.01 < . 1:1(0) ack 3001 win 320
34*5d4cadefSSoham Chakradeo   +0 > P. 12001:14001(2000) ack 1
35*5d4cadefSSoham Chakradeo
36*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 5001 win 320
37*5d4cadefSSoham Chakradeo   +0 > P. 14001:15001(1000) ack 1
38*5d4cadefSSoham Chakradeo
39*5d4cadefSSoham Chakradeo// Client gradually ACKs all data.
40*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 7001 win 320
41*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 9001 win 320
42*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 11001 win 320
43*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 13001 win 320
44*5d4cadefSSoham Chakradeo +.02 < . 1:1(0) ack 15001 win 320
45*5d4cadefSSoham Chakradeo
46*5d4cadefSSoham Chakradeo// Clean up.
47*5d4cadefSSoham Chakradeo +.17 close(4) = 0
48*5d4cadefSSoham Chakradeo   +0 > F. 15001:15001(0) ack 1
49*5d4cadefSSoham Chakradeo  +.1 < F. 1:1(0) ack 15002 win 257
50*5d4cadefSSoham Chakradeo   +0 > . 15002:15002(0) ack 2
51