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