xref: /linux/tools/testing/selftests/net/packetdrill/tcp_user_timeout_user_timeout.pkt (revision 0ad9617c78acbc71373fb341a6f75d4012b01d69)
1// SPDX-License-Identifier: GPL-2.0
2`./defaults.sh`
3
4// Initialize connection
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   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop>
11   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
12  +.1 < . 1:1(0) ack 1 win 32792
13
14
15   +0 accept(3, ..., ...) = 4
16
17// Okay, we received nothing, and decide to close this idle socket.
18// We set TCP_USER_TIMEOUT to 3 seconds because really it is not worth
19// trying hard to cleanly close this flow, at the price of keeping
20// a TCP structure in kernel for about 1 minute !
21   +2 setsockopt(4, SOL_TCP, TCP_USER_TIMEOUT, [3000], 4) = 0
22   +0 close(4) = 0
23
24   +0 > F. 1:1(0) ack 1
25  +.3~+.400 > F. 1:1(0) ack 1
26  +.3~+.400 > F. 1:1(0) ack 1
27  +.6~+.800 > F. 1:1(0) ack 1
28
29// We finally receive something from the peer, but it is way too late
30// Our socket vanished because TCP_USER_TIMEOUT was really small
31   +0 < . 1:2(1) ack 1 win 32792
32   +0 > R 1:1(0)
33