← Documents Documentation/networking/proc_net_tcp.rst GitHub 원문 ↗

Linux 6.18.37 · Networking

/proc/net/tcp와 /proc/net/tcp6 변수

Deprecated proc TCP connection entry의 주소, queue, timer, socket과 congestion field 형식입니다.

Source pathDocumentation/networking/proc_net_tcp.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

proc_net_tcp.rst:1-57

`/proc/net/tcp`와 `tcp6`는 active TCP socket을 한 행의 hexadecimal field로 노출합니다. 현재는 `tcp_diag`가 권장되지만 legacy 출력을 해석할 때 주소·queue·timer·inode·ACK·congestion field 순서를 정확히 알아야 합니다.

TCP proc entry
Entry·local/remote address·stateTX/RX queue·timeruid·inode·ACK·congestion

긴 한 행을 세 field 묶음으로 읽습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ============================================
4 The proc/net/tcp and proc/net/tcp6 variables
5 ============================================
6
7 This document describes the interfaces /proc/net/tcp and /proc/net/tcp6.
8 Note that these interfaces are deprecated in favor of tcp_diag.
9
10 These /proc interfaces provide information about currently active TCP
11 connections, and are implemented by tcp4_seq_show() in net/ipv4/tcp_ipv4.c
12 and tcp6_seq_show() in net/ipv6/tcp_ipv6.c, respectively.
13
14 It will first list all listening TCP sockets, and next list all established
15 TCP connections. A typical entry of /proc/net/tcp would look like this (split
16 up into 3 parts because of the length of the line)::
17
18 46: 010310AC:9C4C 030310AC:1770 01
19 | | | | | |--> connection state
20 | | | | |------> remote TCP port number
21 | | | |-------------> remote IPv4 address
22 | | |--------------------> local TCP port number
23 | |---------------------------> local IPv4 address
24 |----------------------------------> number of entry
25
26 00000150:00000000 01:00000019 00000000
27 | | | | |--> number of unrecovered RTO timeouts
28 | | | |----------> number of jiffies until timer expires
29 | | |----------------> timer_active (see below)
30 | |----------------------> receive-queue
31 |-------------------------------> transmit-queue
32
33 1000 0 54165785 4 cd1e6040 25 4 27 3 -1
34 | | | | | | | | | |--> slow start size threshold,
35 | | | | | | | | | or -1 if the threshold
36 | | | | | | | | | is >= 0xFFFF
37 | | | | | | | | |----> sending congestion window
38 | | | | | | | |-------> (ack.quick<<1)|ack.pingpong
39 | | | | | | |---------> Predicted tick of soft clock
40 | | | | | | (delayed ACK control data)
41 | | | | | |------------> retransmit timeout
42 | | | | |------------------> location of socket in memory
43 | | | |-----------------------> socket reference count
44 | | |-----------------------------> inode
45 | |----------------------------------> unanswered 0-window probes
46 |---------------------------------------------> uid
47
48 timer_active:
49
50 == ================================================================
51 0 no timer is pending
52 1 retransmit-timer is pending
53 2 another timer (e.g. delayed ack or keepalive) is pending
54 3 this is a socket in TIME_WAIT state. Not all fields will contain
55 data (or even exist)
56 4 zero window probe timer is pending
57 == ================================================================
58

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Interface와 출력 순서

1-16

이 문서는 `/proc/net/tcp`와 `/proc/net/tcp6` interface의 출력 형식을 설명합니다. 두 interface는 현재 `tcp_diag`를 선호하므로 deprecated 상태입니다.

현재 활성 TCP connection 정보를 제공하며 IPv4는 `net/ipv4/tcp_ipv4.c`의 `tcp4_seq_show()`, IPv6는 `net/ipv6/tcp_ipv6.c`의 `tcp6_seq_show()`가 구현합니다.

출력은 먼저 모든 listening TCP socket을 나열하고, 이어서 모든 established TCP connection을 나열합니다. 한 entry가 길기 때문에 예제는 세 부분으로 나누어 표시합니다.

/proc TCP 출력 순서
/proc/net/tcp 또는 tcp6 읽기Listening socketsEstablished connections각 entry field 출력

Socket 종류별로 순차 나열합니다.

.. SPDX-License-Identifier: GPL-2.0

============================================
The proc/net/tcp and proc/net/tcp6 variables
============================================

This document describes the interfaces /proc/net/tcp and /proc/net/tcp6.
Note that these interfaces are deprecated in favor of tcp_diag.

These /proc interfaces provide information about currently active TCP
connections, and are implemented by tcp4_seq_show() in net/ipv4/tcp_ipv4.c
and tcp6_seq_show() in net/ipv6/tcp_ipv6.c, respectively.

It will first list all listening TCP sockets, and next list all established
TCP connections. A typical entry of /proc/net/tcp would look like this (split
up into 3 parts because of the length of the line)::

주소·queue·timer field

17-32

첫 부분 `46: 010310AC:9C4C 030310AC:1770 01`은 왼쪽부터 entry 번호, local IPv4 주소, local TCP port, remote IPv4 주소, remote TCP port, connection state를 나타냅니다. 주소와 port는 proc 형식의 hexadecimal 값입니다.

두 번째 부분 `00000150:00000000 01:00000019 00000000`은 transmit queue와 receive queue, `timer_active`, timer 만료까지 남은 jiffies, 복구되지 않은 RTO timeout 수를 나타냅니다.

TCP entry 앞부분
위치예제의미
146Entry number
2010310ACLocal IPv4 address
39C4CLocal TCP port
4030310ACRemote IPv4 address
51770Remote TCP port
601Connection state

예제 한 행의 주소와 연결 field 순서입니다.

TCP entry queue·timer 부분
순서예제의미
100000150Transmit queue
200000000Receive queue
301timer_active
400000019Timer 만료까지 jiffies
500000000복구되지 않은 RTO timeout 수

Colon으로 묶인 queue와 timer field입니다.


   46: 010310AC:9C4C 030310AC:1770 01
   |      |      |      |      |   |--> connection state
   |      |      |      |      |------> remote TCP port number
   |      |      |      |-------------> remote IPv4 address
   |      |      |--------------------> local TCP port number
   |      |---------------------------> local IPv4 address
   |----------------------------------> number of entry

   00000150:00000000 01:00000019 00000000
      |        |     |     |       |--> number of unrecovered RTO timeouts
      |        |     |     |----------> number of jiffies until timer expires
      |        |     |----------------> timer_active (see below)
      |        |----------------------> receive-queue
      |-------------------------------> transmit-queue

Socket·ACK·congestion field

33-47

세 번째 부분은 `uid`, 응답받지 못한 zero-window probe 수, inode, socket reference count, memory의 socket 위치, retransmit timeout, delayed ACK control의 soft-clock predicted tick, ACK mode, sending congestion window, slow-start threshold 순서입니다.

ACK mode 값은 `(ack.quick << 1) | ack.pingpong`입니다. 마지막 slow-start threshold는 실제 threshold가 `0xFFFF` 이상이면 -1로 출력됩니다.

TCP entry 후반 field
순서예제의미
11000uid
20응답 없는 zero-window probe
354165785inode
44Socket reference count
5cd1e6040Memory의 socket 위치
625Retransmit timeout
74Delayed ACK soft-clock predicted tick
827(ack.quick<<1)|ack.pingpong
93Sending congestion window
10-1Slow-start threshold; 0xFFFF 이상이면 -1

세 번째 출력 부분을 왼쪽부터 대응시킵니다.

   1000        0 54165785 4 cd1e6040 25 4 27 3 -1
    |          |    |     |    |     |  | |  | |--> slow start size threshold,
    |          |    |     |    |     |  | |  |      or -1 if the threshold
    |          |    |     |    |     |  | |  |      is >= 0xFFFF
    |          |    |     |    |     |  | |  |----> sending congestion window
    |          |    |     |    |     |  | |-------> (ack.quick<<1)|ack.pingpong
    |          |    |     |    |     |  |---------> Predicted tick of soft clock
    |          |    |     |    |     |              (delayed ACK control data)
    |          |    |     |    |     |------------> retransmit timeout
    |          |    |     |    |------------------> location of socket in memory
    |          |    |     |-----------------------> socket reference count
    |          |    |-----------------------------> inode
    |          |----------------------------------> unanswered 0-window probes
    |---------------------------------------------> uid

timer_active 값

48-57

`timer_active`는 socket에 대기 중인 timer 종류를 나타냅니다. 값 0은 pending timer가 없고, 1은 retransmit timer가 대기 중이며, 2는 delayed ACK나 keepalive 같은 다른 timer가 대기 중이라는 뜻입니다.

값 3은 `TIME_WAIT` 상태 socket입니다. 이 상태에서는 모든 field에 data가 들어 있지 않거나 field 자체가 없을 수 있습니다. 값 4는 zero-window probe timer가 대기 중임을 뜻합니다.

timer_active code
상태
0Pending timer 없음
1Retransmit timer pending
2Delayed ACK·keepalive 등 다른 timer pending
3TIME_WAIT socket; 일부 field 부재 가능
4Zero-window probe timer pending

Proc entry의 timer 상태 값입니다.

timer_active:

 ==  ================================================================
  0  no timer is pending
  1  retransmit-timer is pending
  2  another timer (e.g. delayed ack or keepalive) is pending
  3  this is a socket in TIME_WAIT state. Not all fields will contain
     data (or even exist)
  4  zero window probe timer is pending
 ==  ================================================================