File: tcp_user_timeout_user_timeout.pkt

package info (click to toggle)
linux 6.18.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,742,212 kB
  • sloc: ansic: 26,783,651; asm: 272,129; sh: 148,799; python: 79,242; makefile: 57,742; perl: 36,527; xml: 19,542; cpp: 5,911; yacc: 4,939; lex: 2,950; awk: 1,607; sed: 30; ruby: 25
file content (32 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: GPL-2.0
`./defaults.sh`

// Initialize connection
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
  +.1 < . 1:1(0) ack 1 win 32792


   +0 accept(3, ..., ...) = 4

// Okay, we received nothing, and decide to close this idle socket.
// We set TCP_USER_TIMEOUT to 3 seconds because really it is not worth
// trying hard to cleanly close this flow, at the price of keeping
// a TCP structure in kernel for about 1 minute !
   +2 setsockopt(4, SOL_TCP, TCP_USER_TIMEOUT, [3000], 4) = 0
   +0 close(4) = 0

   +0 > F. 1:1(0) ack 1
  +.3~+.400 > F. 1:1(0) ack 1
  +.3~+.400 > F. 1:1(0) ack 1
  +.6~+.800 > F. 1:1(0) ack 1

// We finally receive something from the peer, but it is way too late
// Our socket vanished because TCP_USER_TIMEOUT was really small
   +0 < . 1:2(1) ack 1 win 32792
   +0 > R 1:1(0)