xref: /linux/tools/testing/selftests/net/packetdrill/tcp_user_timeout_user-timeout-probe.pkt (revision 0ad9617c78acbc71373fb341a6f75d4012b01d69)
1*5d4cadefSSoham Chakradeo// SPDX-License-Identifier: GPL-2.0
2*5d4cadefSSoham Chakradeo
3*5d4cadefSSoham Chakradeo`./defaults.sh`
4*5d4cadefSSoham Chakradeo
5*5d4cadefSSoham Chakradeo    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
6*5d4cadefSSoham Chakradeo   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
7*5d4cadefSSoham Chakradeo   +0 bind(3, ..., ...) = 0
8*5d4cadefSSoham Chakradeo   +0 listen(3, 1) = 0
9*5d4cadefSSoham Chakradeo
10*5d4cadefSSoham Chakradeo
11*5d4cadefSSoham Chakradeo   +0 < S 0:0(0) win 0 <mss 1460>
12*5d4cadefSSoham Chakradeo   +0 > S. 0:0(0) ack 1 <mss 1460>
13*5d4cadefSSoham Chakradeo
14*5d4cadefSSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 65530
15*5d4cadefSSoham Chakradeo   +0 accept(3, ..., ...) = 4
16*5d4cadefSSoham Chakradeo
17*5d4cadefSSoham Chakradeo   +0 setsockopt(4, SOL_TCP, TCP_USER_TIMEOUT, [3000], 4) = 0
18*5d4cadefSSoham Chakradeo   +0 write(4, ..., 24) = 24
19*5d4cadefSSoham Chakradeo   +0 > P. 1:25(24) ack 1
20*5d4cadefSSoham Chakradeo   +.1 < . 1:1(0) ack 25 win 65530
21*5d4cadefSSoham Chakradeo   +0 %{ assert tcpi_probes == 0, tcpi_probes; \
22*5d4cadefSSoham Chakradeo         assert tcpi_backoff == 0, tcpi_backoff }%
23*5d4cadefSSoham Chakradeo
24*5d4cadefSSoham Chakradeo// install a qdisc dropping all packets
25*5d4cadefSSoham Chakradeo   +0 `tc qdisc delete dev tun0 root 2>/dev/null ; tc qdisc add dev tun0 root pfifo limit 0`
26*5d4cadefSSoham Chakradeo   +0 write(4, ..., 24) = 24
27*5d4cadefSSoham Chakradeo   // When qdisc is congested we retry every 500ms
28*5d4cadefSSoham Chakradeo   // (TCP_RESOURCE_PROBE_INTERVAL) and therefore
29*5d4cadefSSoham Chakradeo   // we retry 6 times before hitting 3s timeout.
30*5d4cadefSSoham Chakradeo   // First verify that the connection is alive:
31*5d4cadefSSoham Chakradeo+3.250 write(4, ..., 24) = 24
32*5d4cadefSSoham Chakradeo   // Now verify that shortly after that the socket is dead:
33*5d4cadefSSoham Chakradeo +.100 write(4, ..., 24) = -1 ETIMEDOUT (Connection timed out)
34*5d4cadefSSoham Chakradeo
35*5d4cadefSSoham Chakradeo   +0 %{ assert tcpi_probes == 6, tcpi_probes; \
36*5d4cadefSSoham Chakradeo         assert tcpi_backoff == 0, tcpi_backoff }%
37*5d4cadefSSoham Chakradeo   +0 close(4) = 0
38