Debian Codegraph @

tools/testing/selftests/net/packetdrill/tcp_user_timeout_user-timeout-probe.pkt

raw
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
27 +0 write(4, ..., 24) = 24
28 // When qdisc is congested we retry every 500ms
29 // (TCP_RESOURCE_PROBE_INTERVAL) and therefore
30 // we retry 6 times before hitting 3s timeout.
31 // First verify that the connection is alive:
32 +3 write(4, ..., 24) = 24
33
34 // Now verify that shortly after that the socket is dead:
35 +1 write(4, ..., 24) = -1 ETIMEDOUT (Connection timed out)
36
37 +0 %{ assert tcpi_probes == 6, tcpi_probes; \
38 assert tcpi_backoff == 0, tcpi_backoff }%
39 +0 close(4) = 0