요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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)::
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
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:
== ================================================================
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
== ================================================================
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가 길기 때문에 예제는 세 부분으로 나누어 표시합니다.
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 수를 나타냅니다.
예제 한 행의 주소와 연결 field 순서입니다.
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로 출력됩니다.
세 번째 출력 부분을 왼쪽부터 대응시킵니다.
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가 대기 중임을 뜻합니다.
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
== ================================================================
요약·해설
proc_net_tcp.rst:1-57`/proc/net/tcp`와 `tcp6`는 active TCP socket을 한 행의 hexadecimal field로 노출합니다. 현재는 `tcp_diag`가 권장되지만 legacy 출력을 해석할 때 주소·queue·timer·inode·ACK·congestion field 순서를 정확히 알아야 합니다.
긴 한 행을 세 field 묶음으로 읽습니다.