162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci============================================
462306a36Sopenharmony_ciThe proc/net/tcp and proc/net/tcp6 variables
562306a36Sopenharmony_ci============================================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThis document describes the interfaces /proc/net/tcp and /proc/net/tcp6.
862306a36Sopenharmony_ciNote that these interfaces are deprecated in favor of tcp_diag.
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciThese /proc interfaces provide information about currently active TCP
1162306a36Sopenharmony_ciconnections, and are implemented by tcp4_seq_show() in net/ipv4/tcp_ipv4.c
1262306a36Sopenharmony_ciand tcp6_seq_show() in net/ipv6/tcp_ipv6.c, respectively.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciIt will first list all listening TCP sockets, and next list all established
1562306a36Sopenharmony_ciTCP connections. A typical entry of /proc/net/tcp would look like this (split
1662306a36Sopenharmony_ciup into 3 parts because of the length of the line)::
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci   46: 010310AC:9C4C 030310AC:1770 01
1962306a36Sopenharmony_ci   |      |      |      |      |   |--> connection state
2062306a36Sopenharmony_ci   |      |      |      |      |------> remote TCP port number
2162306a36Sopenharmony_ci   |      |      |      |-------------> remote IPv4 address
2262306a36Sopenharmony_ci   |      |      |--------------------> local TCP port number
2362306a36Sopenharmony_ci   |      |---------------------------> local IPv4 address
2462306a36Sopenharmony_ci   |----------------------------------> number of entry
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci   00000150:00000000 01:00000019 00000000
2762306a36Sopenharmony_ci      |        |     |     |       |--> number of unrecovered RTO timeouts
2862306a36Sopenharmony_ci      |        |     |     |----------> number of jiffies until timer expires
2962306a36Sopenharmony_ci      |        |     |----------------> timer_active (see below)
3062306a36Sopenharmony_ci      |        |----------------------> receive-queue
3162306a36Sopenharmony_ci      |-------------------------------> transmit-queue
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci   1000        0 54165785 4 cd1e6040 25 4 27 3 -1
3462306a36Sopenharmony_ci    |          |    |     |    |     |  | |  | |--> slow start size threshold,
3562306a36Sopenharmony_ci    |          |    |     |    |     |  | |  |      or -1 if the threshold
3662306a36Sopenharmony_ci    |          |    |     |    |     |  | |  |      is >= 0xFFFF
3762306a36Sopenharmony_ci    |          |    |     |    |     |  | |  |----> sending congestion window
3862306a36Sopenharmony_ci    |          |    |     |    |     |  | |-------> (ack.quick<<1)|ack.pingpong
3962306a36Sopenharmony_ci    |          |    |     |    |     |  |---------> Predicted tick of soft clock
4062306a36Sopenharmony_ci    |          |    |     |    |     |              (delayed ACK control data)
4162306a36Sopenharmony_ci    |          |    |     |    |     |------------> retransmit timeout
4262306a36Sopenharmony_ci    |          |    |     |    |------------------> location of socket in memory
4362306a36Sopenharmony_ci    |          |    |     |-----------------------> socket reference count
4462306a36Sopenharmony_ci    |          |    |-----------------------------> inode
4562306a36Sopenharmony_ci    |          |----------------------------------> unanswered 0-window probes
4662306a36Sopenharmony_ci    |---------------------------------------------> uid
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_citimer_active:
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci ==  ================================================================
5162306a36Sopenharmony_ci  0  no timer is pending
5262306a36Sopenharmony_ci  1  retransmit-timer is pending
5362306a36Sopenharmony_ci  2  another timer (e.g. delayed ack or keepalive) is pending
5462306a36Sopenharmony_ci  3  this is a socket in TIME_WAIT state. Not all fields will contain
5562306a36Sopenharmony_ci     data (or even exist)
5662306a36Sopenharmony_ci  4  zero window probe timer is pending
5762306a36Sopenharmony_ci ==  ================================================================
58