.br
\fB#include <netpacket/packet.h>\fP
.br
-\fB#include <net/ethernet.h> /* the L2 protocols */\fP
+\fB#include <net/ethernet.h> /* L2 プロトコル */\fP
.sp
\fBpacket_socket = socket(AF_PACKET, int \fP\fIsocket_type\fP\fB, int \fP\fIprotocol\fP\fB);\fP
.fi
.TP
\fBPACKET_AUXDATA\fP (Linux 2.6.21 以降)
.\" commit 8dc4194474159660d7f37c495e3fc3f10d0db8cc
-If this binary option is enabled, the packet socket passes a metadata
-structure along with each packet in the \fBrecvmsg\fP(2) control field. The
-structure can be read with \fBcmsg\fP(3). It is defined as
+ブール値のオプションを有効すると、 パケットソケットは、パケットと一緒にメタデータ構造体を \fBrecvmsg\fP(2) コントロールフィールドで渡す。
+この構造体は \fBcmsg\fP(3) を使って読むことができる。 定義は以下の通りである。
.in +4n
.nf
struct tpacket_auxdata {
__u32 tp_status;
- __u32 tp_len; /* packet length */
- __u32 tp_snaplen; /* captured length */
+ __u32 tp_len; /* パケット長 */
+ __u32 tp_snaplen; /* キャプチャした長さ */
__u16 tp_mac;
__u16 tp_net;
__u16 tp_vlan_tci;
.TP
\fBPACKET_FANOUT\fP (Linux 3.1 以降)
.\" commit dc99f600698dcac69b8f56dda9a8a00d645c5ffc
-To scale processing across threads, packet sockets can form a fanout group.
-In this mode, each matching packet is enqueued onto only one socket in the
-group. A socket joins a fanout group by calling \fBsetsockopt\fP(2) with
-level \fBSOL_PACKET\fP and option \fBPACKET_FANOUT\fP. Each network namespace can
-have up to 65536 independent groups. A socket selects a group by encoding
-the ID in the first 16 bits of the integer option value. The first packet
-socket to join a group implicitly creates it. To successfully join an
-existing group, subsequent packet sockets must have the same protocol,
-device settings, fanout mode and flags (see below). Packet sockets can
-leave a fanout group only by closing the socket. The group is deleted when
-the last socket is closed.
+スレッドにまたがって処理をスケールさせるため、 パケットソケットはファンアウトグループを構成することができる。 このモードでは、
+マッチしたそれぞれのパケットはグループ内のいずれか一つのソケットにだけキューイングされる。 ソケットをファンアウトグループに参加させるには、 レベル
+\fBSOL_PACKET\fP でオプション \fBPACKET_FANOUT\fP を指定して \fBsetsockopt\fP(2) を呼び出す。
+ネットワーク名前空間毎に最大 65536 個の独立したグループを持つことができる。 整数のオプション値の先頭 16 ビットに ID
+をエンコードすることで、 ソケットはグループを選択する。 あるグループへの最初のパケットソケットの参加があった時点で、
+グループは暗黙のうちに作成される。 既存のグループへの参加が成功するためには、 それ以降にそのグループに参加しようとするパケットソケットは、
+プロトコロ、 デバイス設定、ファンアウトモード、フラグが同じである必要がある (下記参照)。 パケットソケットがファンアウトグループから抜けるのは、
+そのソケットをクローズした場合だけである。 ファンアウトグループは最後のソケットがクローズした場合に削除される。
.\" commit 2d36097d26b5991d71a2cf4a20c1a158f0f1bfcd
-Fanout supports multiple algorithms to spread traffic between sockets. The
-default mode, \fBPACKET_FANOUT_HASH\fP, sends packets from the same flow to the
-same socket to maintain per\-flow ordering. For each packet, it chooses a
-socket by taking the packet flow hash modulo the number of sockets in the
-group, where a flow hash is a hash over network\-layer address and optional
-transport\-layer port fields. The load\-balance mode \fBPACKET_FANOUT_LB\fP
-implements a round\-robin algorithm. \fBPACKET_FANOUT_CPU\fP selects the socket
-based on the CPU that the packet arrived on. \fBPACKET_FANOUT_ROLLOVER\fP
-processes all data on a single socket, moves to the next when one becomes
-backlogged. \fBPACKET_FANOUT_RND\fP selects the socket using a pseudo\-random
-number generator. \fBPACKET_FANOUT_QM\fP (available since Linux 3.14) selects
-the socket using the recorded queue_mapping of the received skb.
-
-Fanout modes can take additional options. IP fragmentation causes packets
-from the same flow to have different flow hashes. The flag
-\fBPACKET_FANOUT_FLAG_DEFRAG\fP, if set, causes packet to be defragmented
-before fanout is applied, to preserve order even in this case. Fanout mode
-and options are communicated in the second 16 bits of the integer option
-value. The flag \fBPACKET_FANOUT_FLAG_ROLLOVER\fP enables the roll over
-mechanism as a backup strategy: if the original fanout algorithm selects a
-backlogged socket, the packet rolls over to the next available one.
+ファンアウトでは、 複数のソケットにトラフィックを分散させるアルゴリズムを複数サポートしている。 デフォルトのモードである
+\fBPACKET_FANOUT_HASH\fP では、同じフローのパケットは同じソケットに送信され、 フロー単位の順序が維持される。
+パケットごとに、パケットフローのハッシュの、そのグループのソケット数に対する剰余が計算され、ソケットが選択される。
+なお、フローハッシュはネットワーク層のアドレスとトランスポート層のポートフィールドに対するハッシュである (トランスポート層ポートは存在する場合のみ)。
+負荷分散モード \fBPACKET_FANOUT_LB\fP はラウンドロビンアルゴリズムが採用されている。 \fBPACKET_FANOUT_CPU\fP では、
+パケットが到着した CPU に基づいてソケットを選択する。 \fBPACKET_FANOUT_ROLLOVER\fP
+はすべてのデータを一つのソケットで処理し、 そのソケットで処理待ち (backlog) が発生した場合に次のソケットに移る。
+\fBPACKET_FANOUT_RND\fP では擬似乱数発生器を使ってソケットが選択される。 \fBPACKET_FANOUT_QM\fP (Linux
+3.14 以降で利用可能) では受信 skb に記録された queue_mapping を使ってソケットが選択される。
+
+ファンアウトモードでは追加のオプションがある。 IP フラグメンテーションが起こると、
+同じフローのパケットのフローハッシュが異なるハッシュを持つことになる。 フラグ \fBPACKET_FANOUT_FLAG_DEFRAG\fP
+をセットすると、 パケットはファンアウトを行う前にフラグメント再構築が行われるようになり、 フラグメントがあった場合でも順序が維持される。
+ファンアウトモードとオプションは、 整数のオプション値の下位 16 ビットで指定される。 フラグ
+\fBPACKET_FANOUT_FLAG_ROLLOVER\fP を指定すると、 バックアップ戦略としてロールオーバー方式が有効になる。
+元のファンアウトアルゴリズムが backlog ソケットを選択していれば、 パケットは次の利用可能なソケットにロールオーバーされる。
.TP
-\fBPACKET_LOSS\fP (with \fBPACKET_TX_RING\fP)
-If set, do not silently drop a packet on transmission error, but return it
-with status set to \fBTP_STATUS_WRONG_FORMAT\fP.
+\fBPACKET_LOSS\fP (\fBPACKET_TX_RING\fP で使用)
+有効にすると、転送エラーの場合にパケットをエラーなしに黙って破棄せず、 ステータスを \fBTP_STATUS_WRONG_FORMAT\fP
+にセットして返る。
.TP
-\fBPACKET_RESERVE\fP (with \fBPACKET_RX_RING\fP)
-By default, a packet receive ring writes packets immediately following the
-metadata structure and alignment padding. This integer option reserves
-additional headroom.
+\fBPACKET_RESERVE\fP (\fBPACKET_RX_RING\fP で使用)
+デフォルトでは、パケット受信リングはメタデータ構造体とアライメント用のパディングの直後にパケットを書き込む。
+この整数オプションを設定すると、パケットの前に追加で領域が予約される。
.TP
\fBPACKET_RX_RING\fP
-Create a memory\-mapped ring buffer for asynchronous packet reception. The
-packet socket reserves a contiguous region of application address space,
-lays it out into an array of packet slots and copies packets (up to
-\fItp_snaplen\fP) into subsequent slots. Each packet is preceded by a
-metadata structure similar to \fItpacket_auxdata\fP. The protocol fields
-encode the offset to the data from the start of the metadata header.
-\fItp_net\fP stores the offset to the network layer. If the packet socket is
-of type \fBSOCK_DGRAM\fP, then \fItp_mac\fP is the same. If it is of type
-\fBSOCK_RAW\fP, then that field stores the offset to the link\-layer frame.
-Packet socket and application communicate the head and tail of the ring
-through the \fItp_status\fP field. The packet socket owns all slots with
-status \fBTP_STATUS_KERNEL\fP. After filling a slot, it changes the status of
-the slot to transfer ownership to the application. During normal operation,
-the new status is \fBTP_STATUS_USER\fP, to signal that a correctly received
-packet has been stored. When the application has finished processing a
-packet, it transfers ownership of the slot back to the socket by setting the
-status to \fBTP_STATUS_KERNEL\fP. Packet sockets implement multiple variants
-of the packet ring. The implementation details are described in
-\fIDocumentation/networking/packet_mmap.txt\fP in the Linux kernel source tree.
+非同期でのパケット受信用のメモリマップされたリングバッファを作成する。 パケットソケットはアプリケーションのアドレス空間に連続する領域を確保し、
+そこにパケットスロットの配列を構成し、 (最大 \fItp_snaplen\fP 個の) パケットを順にスロットにコピーする。 各パケットの前には
+\fItpacket_auxdata\fP に似たメタデータ構造体が置かれる。
+プロトコルフィールドには、データの、メタデータヘッダーの先頭からのオフセットが入る。 \fItp_net\fP にはネットワーク層へのオフセットが格納される。
+パケットソケットが \fBSOCK_DGRAM\fP 型の場合、 \fItp_mac\fP も同じである。 \fBSOCK_RAW\fP 型の場合、 \fItp_net\fP
+にはリンク層のフレームへのオフセットが入る。 パケットソケットとアプリケーションは \fItp_status\fP フィールドを通してリングの先頭
+(head) と末尾 (tail) の情報を受け渡す。 パケットソケットはすべてのスロットをステータス \fBTP_STATUS_KERNEL\fP
+で所有しており、 スロットにデータが入ると、パケットソケットはそのスロットのステータスをアプリケーションに所有権を渡す状態に変更する。
+通常の動作では、新しいステータスは \fBTP_STATUS_USER\fP であり、これは正しく受信されたパケットが格納されたことを示している。
+アプリケーションがパケットの処理を終えると、アプリケーションはそのスロットのステータスを \fBTP_STATUS_KERNEL\fP
+に設定し、そのスロットの所有権をソケットに返す。 パケットソケットは、複数バージョンのパケットリングを実装している。 実装の詳細は Linux
+カーネルソースツリーの \fIDocumentation/networking/packet_mmap.txt\fP で説明されている。
.TP
\fBPACKET_STATISTICS\fP
-Retrieve packet socket statistics in the form of a structure
+パケットソケットの統計情報を次の構造体形式で取得する。
.in +4n
.nf
struct tpacket_stats {
- unsigned int tp_packets; /* Total packet count */
- unsigned int tp_drops; /* Dropped packet count */
+ unsigned int tp_packets; /* 総パケット数 */
+ unsigned int tp_drops; /* ドロップパケット数 */
};
.fi
.in
-Receiving statistics resets the internal counters. The statistics structure
-differs when using a ring of variant \fBTPACKET_V3\fP.
+統計情報を取得すると、内部カウンターはリセットされる。 \fBTPACKET_V3\fP のリングを使う場合には、統計情報構造体は違うものになる。
.TP
-\fBPACKET_TIMESTAMP\fP (with \fBPACKET_RX_RING\fP; since Linux 2.6.36)
+\fBPACKET_TIMESTAMP\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.36 以降)
.\" commit 614f60fa9d73a9e8fdff3df83381907fea7c5649
-The packet receive ring always stores a timestamp in the metadata header.
-By default, this is a software generated timestamp generated when the packet
-is copied into the ring. This integer option selects the type of
-timestamp. Besides the default, it support the two hardware formats
-described in \fIDocumentation/networking/timestamping.txt\fP in the Linux
-kernel source tree.
+パケット受信リングでは常にタイムスタンプがメタデータヘッダーに格納される。
+デフォルトでは、タイムスタンプはパケットがリングにコピーされた時点で生成されるソフトウェアによるタイムスタンプである。
+この整数オプションによりタイムスタンプの種類を選択できる。 デフォルト以外では、 Linux カーネルソースツリーの
+\fIDocumentation/networking/timestamping.txt\fP に説明がある 2
+種類のハードウェアフォーマットがサポートされている。
.TP
\fBPACKET_TX_RING\fP (Linux 2.6.31 以降)
.\" commit 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1
-Create a memory\-mapped ring buffer for packet transmission. This option is
-similar to \fBPACKET_RX_RING\fP and takes the same arguments. The application
-writes packets into slots with status \fBTP_STATUS_AVAILABLE\fP and schedules
-them for transmission by changing the status to \fBTP_STATUS_SEND_REQUEST\fP.
-When packets are ready to be transmitted, the application calls \fBsend\fP(2)
-or a variant thereof. The \fIbuf\fP and \fIlen\fP fields of this call are
-ignored. If an address is passed using \fBsendto\fP(2) or \fBsendmsg\fP(2), then
-that overrides the socket default. On successful transmission, the socket
-resets the slot to \fBTP_STATUS_AVAILABLE\fP. It discards packets silently on
-error unless \fBPACKET_LOSS\fP is set.
+パケット送信用のメモリマップされたリングバッファを作成する。 このオプションは \fBPACKET_RX_RING\fP と同様で、同じ引き数を取る。
+アプリケーションはステータスが \fBTP_STATUS_AVAILABLE\fP のスロットにパケットを書き込み、
+\fBTP_STATUS_SEND_REQUEST\fP にステータスを変更することでそのパケットが送信できるようにする。
+パケットの送信準備ができたら、アプリケーションは続けて \fBsend\fP(2) 系のシステムコールを呼び出す。 システムコールの引き数 \fIbuf\fP と
+\fIlen\fP は無視される。 \fBsendto\fP(2) や \fBsendmsg\fP(2) を使ってアドレスが渡された場合、
+ソケットのデフォルト値ではなくそのアドレスが使用される。 送信に成功すると、ソケットはそのスロットを \fBTP_STATUS_AVAILABLE\fP
+に戻す。 エラーの場合、 \fBPACKET_LOSS\fP がセットされていなければエラーなしでパケットは廃棄される。
.TP
-\fBPACKET_VERSION\fP (with \fBPACKET_RX_RING\fP; since Linux 2.6.27)
+\fBPACKET_VERSION\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.27 以降)
.\" commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279
-By default, \fBPACKET_RX_RING\fP creates a packet receive ring of variant
-\fBTPACKET_V1\fP. To create another variant, configure the desired variant by
-setting this integer option before creating the ring.
+デフォルトでは、 \fBPACKET_RX_RING\fP は \fBTPACKET_V1\fP
+のパケット受信リングを作成する。別のバージョンのリングを作成するには、そのリングを作成する前に希望するバージョンが使われるようにこの整数オプションを設定すること。
.TP
\fBPACKET_QDISC_BYPASS\fP (Linux 3.14 以降)
.\" commit d346a3fae3ff1d99f5d0c819bf86edf9094a26a1
-By default, packets sent through packet sockets pass through the kernel's
-qdisc (traffic control) layer, which is fine for the vast majority of use
-cases. For traffic generator appliances using packet sockets that intend to
-brute\-force flood the network\(emfor example, to test devices under load in
-a similar fashion to pktgen\(emthis layer can be bypassed by setting this
-integer option to 1. A side effect is that packet buffering in the qdisc
-layer is avoided, which will lead to increased drops when network device
-transmit queues are busy; therefore, use at your own risk.
+デフォルトでは、パケットはカーネルの qdisc (トラフィック制御) レイヤー経由で渡される。 これは大半のユースケースに合っている。
+ネットワークに対して可能な限りパケットを送信する (例えば pkggen と同様の方法で負荷対象のデバイスを試験する)
+のにパケットソケットを使うトラフィック生成アプライアンスでは、この整数オプションを 1 に設定することで qdisc レイヤーを飛ばすことができる。
+qdisc レイヤーでのパケットバッファが行われなくなるという副作用がある。 これにより、
+ネットワークデバイスの送信キューの使用量が高い場合にパケット廃棄が起きやすくなる。
.SS ioctl
.\" FIXME Document SIOCGSTAMPNS
\fBSIOCGSTAMP\fP を用いると、最後に受信したパケットのタイムスタンプを得ることができる。 引き数は \fIstruct timeval\fP
\fItcp_autocorking\fP (ブール値; デフォルト: 有効; Linux 3.14 以降)
.\" commit f54b311142a92ea2e42598e347b84e1655caf8e3
.\" Text heavily based on Documentation/networking/ip-sysctl.txt
-If this option is enabled, the kernel tries to coalesce small writes (from
-consecutive \fBwrite\fP(2) and \fBsendmsg\fP(2) calls) as much as possible, in
-order to decrease the total number of sent packets. Coalescing is done if
-at least one prior packet for the flow is waiting in Qdisc queues or device
-transmit queue. Applications can still use the \fBTCP_CORK\fP socket option to
-obtain optimal behavior when they know how/when to uncork their sockets.
+このオプションを有効にすると、 送信総パケット数を減らすため、 カーネルは小さな write (連続する \fBwrite\fP(2) や
+\fBsendmsg\fP(2) の呼び出し) を可能な限り結合しようとする。 パケットの結合が行われるのは、そのフローの前のパケットが少なくとも一つは
+qdisc キューかデバイスの送信キューで送信待ちの場合である。 このオプションが有効な場合でも \fBTCP_CORK\fP
+オプションを使うことができ、アプリケーションがソケットの「コルク解除」(送信待ち状態の解除)
+をいつどのように行えばよいか分かっている場合には、最適な動作をさせることができる。
.TP
\fItcp_available_congestion_control\fP (String; read\-only; Linux 2.4.20 以降)
.\" The following is from 2.6.28-rc4: Documentation/networking/ip-sysctl.txt
\fBTCP_CONGESTION\fP (Linux 2.6.13 以降)
.\" commit 5f8ef48d240963093451bcf83df89f1a1364f51d
.\" Author: Stephen Hemminger <shemminger@osdl.org>
-The argument for this option is a string. This option allows the caller to
-set the TCP congestion control algorithm to be used, on a per\-socket basis.
-Unprivileged processes are restricted to choosing one of the algorithms in
-\fItcp_allowed_congestion_control\fP (described above). Privileged processes
-(\fBCAP_NET_ADMIN\fP) can choose from any of the available congestion\-control
-algorithms (see the description of \fItcp_available_congestion_control\fP
-above).
+このオプションの引き数は文字列である。 このオプションを使うと、呼び出し元がソケット単位に使用する TCP 輻輳制御アルゴリズムを設定することができる。
+非特権プロセスが使用できるアルゴリズムは (上述の) \fItcp_allowed_congestion_control\fP
+で設定されたものだけに制限される。 特権プロセス (\fBCAP_NET_ADMIN\fP) は任意の輻輳制御アルゴリズムを選択することができる (上記の
+\fBtcp_available_congestion_control\fP の説明を参照)。
.TP
\fBTCP_CORK\fP (Linux 2.2 以降)
.\" precisely: since 2.1.127
.\" The following text taken nearly verbatim from Jerry Chu's (excellent)
.\" commit message.
.\"
-This option takes an \fIunsigned int\fP as an argument. When the value is
-greater than 0, it specifies the maximum amount of time in milliseconds that
-transmitted data may remain unacknowledged before TCP will forcibly close
-the corresponding connection and return \fBETIMEDOUT\fP to the application. If
-the option value is specified as 0, TCP will to use the system default.
+このオプションは \fIunsigned int\fP 型の引き数を取る。 値が 0 より大きい場合、その値は、 どのくらいの時間、送信されたデータが ACK
+を受信しないままの状態が続くと、 TCP がその接続を強制的にクローズし、アプリケーションに \fBETIMEDOUT\fP を返すかを、
+ミリ秒単位で指定する。 オプションの値が 0 の場合、TCP はシステムのデフォルト値を使用する。
-Increasing user timeouts allows a TCP connection to survive extended periods
-without end\-to\-end connectivity. Decreasing user timeouts allows
-applications to "fail fast", if so desired. Otherwise, failure may take up
-to 20 minutes with the current system defaults in a normal WAN environment.
+ユーザータイムアウトを長くすると、 通信の両端での接続性がない場合でも長い時間 TCP 接続が維持されるようになる。 ユーザータイムアウトを短くすると、
+アプリケーションは必要であれば「早く失敗」できるようになる。 設定しなかった場合は、 通常の WAN 環境では現在のシステムのデフォルトの 20
+分で失敗することになる。
-This option can be set during any state of a TCP connection, but is only
-effective during the synchronized states of a connection (ESTABLISHED,
-FIN\-WAIT\-1, FIN\-WAIT\-2, CLOSE\-WAIT, CLOSING, and LAST\-ACK). Moreover, when
-used with the TCP keepalive (\fBSO_KEEPALIVE\fP) option, \fBTCP_USER_TIMEOUT\fP
-will override keepalive to determine when to close a connection due to
-keepalive failure.
+このオプションは TCP 接続がどの状態の場合でも設定することができるが、 接続が同期状態 (ESTABLISHED, FIN\-WAIT\-1,
+FIN\-WAIT\-2, CLOSE\-WAIT, CLOSING, LAST\-ACK) の場合のみ効果がある。 また、 TCP keepalive
+(\fBSO_KEEPALIVE\fP) オプションとともに使用された場合、 \fBTCP_USER_TIMEOUT\fP は keepalive
+失敗による接続クローズを判定するための keepalive 値を上書きする。
-The option has no effect on when TCP retransmits a packet, nor when a
-keepalive probe is sent.
+このオプションは TCP がパケットを再送する際や keepalive プローブを送信する際には影響を及ぼさない。
-This option, like many others, will be inherited by the socket returned by
-\fBaccept\fP(2), if it was set on the listening socket.
+他の多くのオプション同様、リッスン中のソケットでこのオプションがセットされていれば \fBaccept\fP(2) が返すソケットにオプションが継承される。
-Further details on the user timeout feature can be found in RFC\ 793 and
-RFC\ 5482 ("TCP User Timeout Option").
+ユーザータイムアウト機能の詳細は RFC\ 793 と RFC\ 5482 ("TCP User Timeout Option") に書かれている。
.TP
\fBTCP_WINDOW_CLAMP\fP (Linux 2.4 以降)
.\" Precisely: since 2.3.41
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2014-04-24 00:51+0900\n"
-"PO-Revision-Date: 2014-04-24 05:23+0900\n"
+"PO-Revision-Date: 2014-04-27 01:54+0900\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
#: build/C/man7/packet.7:22
#, no-wrap
msgid "B<#include E<lt>net/ethernet.hE<gt> /* the L2 protocols */>\n"
-msgstr "B<#include E<lt>net/ethernet.hE<gt> /* the L2 protocols */>\n"
+msgstr "B<#include E<lt>net/ethernet.hE<gt> /* L2 プロトコル */>\n"
#. type: Plain text
#: build/C/man7/packet.7:24
"If this binary option is enabled, the packet socket passes a metadata "
"structure along with each packet in the B<recvmsg>(2) control field. The "
"structure can be read with B<cmsg>(3). It is defined as"
-msgstr ""
+msgstr "ブール値のオプションを有効すると、 パケットソケットは、パケットと一緒にメタデータ構造体を B<recvmsg>(2) コントロールフィールドで渡す。 この構造体は B<cmsg>(3) を使って読むことができる。 定義は以下の通りである。"
#. type: Plain text
#: build/C/man7/packet.7:258
" __u16 tp_padding;\n"
"};\n"
msgstr ""
+"struct tpacket_auxdata {\n"
+" __u32 tp_status;\n"
+" __u32 tp_len; /* パケット長 */\n"
+" __u32 tp_snaplen; /* キャプチャした長さ */\n"
+" __u16 tp_mac;\n"
+" __u16 tp_net;\n"
+" __u16 tp_vlan_tci;\n"
+" __u16 tp_padding;\n"
+"};\n"
#. type: TP
#: build/C/man7/packet.7:260
"device settings, fanout mode and flags (see below). Packet sockets can "
"leave a fanout group only by closing the socket. The group is deleted when "
"the last socket is closed."
-msgstr ""
+msgstr "スレッドにまたがって処理をスケールさせるため、 パケットソケットはファンアウトグループを構成することができる。 このモードでは、 マッチしたそれぞれのパケットはグループ内のいずれか一つのソケットにだけキューイングされる。 ソケットをファンアウトグループに参加させるには、 レベル B<SOL_PACKET> でオプション B<PACKET_FANOUT> を指定して B<setsockopt>(2) を呼び出す。 ネットワーク名前空間毎に最大 65536 個の独立したグループを持つことができる。 整数のオプション値の先頭 16 ビットに ID をエンコードすることで、 ソケットはグループを選択する。 あるグループへの最初のパケットソケットの参加があった時点で、 グループは暗黙のうちに作成される。 既存のグループへの参加が成功するためには、 それ以降にそのグループに参加しようとするパケットソケットは、 プロトコロ、 デバイス設定、ファンアウトモード、フラグが同じである必要がある (下記参照)。 パケットソケットがファンアウトグループから抜けるのは、 そのソケットをクローズした場合だけである。 ファンアウトグループは最後のソケットがクローズした場合に削除される。"
#. commit 2d36097d26b5991d71a2cf4a20c1a158f0f1bfcd
#. type: Plain text
"backlogged. B<PACKET_FANOUT_RND> selects the socket using a pseudo-random "
"number generator. B<PACKET_FANOUT_QM> (available since Linux 3.14) selects "
"the socket using the recorded queue_mapping of the received skb."
-msgstr ""
+msgstr "ファンアウトでは、 複数のソケットにトラフィックを分散させるアルゴリズムを複数サポートしている。 デフォルトのモードである B<PACKET_FANOUT_HASH> では、同じフローのパケットは同じソケットに送信され、 フロー単位の順序が維持される。 パケットごとに、パケットフローのハッシュの、そのグループのソケット数に対する剰余が計算され、ソケットが選択される。 なお、フローハッシュはネットワーク層のアドレスとトランスポート層のポートフィールドに対するハッシュである (トランスポート層ポートは存在する場合のみ)。 負荷分散モード B<PACKET_FANOUT_LB> はラウンドロビンアルゴリズムが採用されている。 B<PACKET_FANOUT_CPU> では、 パケットが到着した CPU に基づいてソケットを選択する。 B<PACKET_FANOUT_ROLLOVER> はすべてのデータを一つのソケットで処理し、 そのソケットで処理待ち (backlog) が発生した場合に次のソケットに移る。 B<PACKET_FANOUT_RND> では擬似乱数発生器を使ってソケットが選択される。 B<PACKET_FANOUT_QM> (Linux 3.14 以降で利用可能) では受信 skb に記録された queue_mapping を使ってソケットが選択される。"
#. type: Plain text
#: build/C/man7/packet.7:320
"value. The flag B<PACKET_FANOUT_FLAG_ROLLOVER> enables the roll over "
"mechanism as a backup strategy: if the original fanout algorithm selects a "
"backlogged socket, the packet rolls over to the next available one."
-msgstr ""
+msgstr "ファンアウトモードでは追加のオプションがある。 IP フラグメンテーションが起こると、 同じフローのパケットのフローハッシュが異なるハッシュを持つことになる。 フラグ B<PACKET_FANOUT_FLAG_DEFRAG> をセットすると、 パケットはファンアウトを行う前にフラグメント再構築が行われるようになり、 フラグメントがあった場合でも順序が維持される。 ファンアウトモードとオプションは、 整数のオプション値の下位 16 ビットで指定される。 フラグ B<PACKET_FANOUT_FLAG_ROLLOVER> を指定すると、 バックアップ戦略としてロールオーバー方式が有効になる。 元のファンアウトアルゴリズムが backlog ソケットを選択していれば、 パケットは次の利用可能なソケットにロールオーバーされる。"
#. type: TP
#: build/C/man7/packet.7:320
#, no-wrap
msgid "B<PACKET_LOSS> (with B<PACKET_TX_RING>)"
-msgstr ""
+msgstr "B<PACKET_LOSS> (B<PACKET_TX_RING> で使用)"
#. type: Plain text
#: build/C/man7/packet.7:325
msgid ""
"If set, do not silently drop a packet on transmission error, but return it "
"with status set to B<TP_STATUS_WRONG_FORMAT>."
-msgstr ""
+msgstr "有効にすると、転送エラーの場合にパケットをエラーなしに黙って破棄せず、 ステータスを B<TP_STATUS_WRONG_FORMAT> にセットして返る。"
#. type: TP
#: build/C/man7/packet.7:325
#, no-wrap
msgid "B<PACKET_RESERVE> (with B<PACKET_RX_RING>)"
-msgstr ""
+msgstr "B<PACKET_RESERVE> (B<PACKET_RX_RING> で使用)"
#. type: Plain text
#: build/C/man7/packet.7:330
"By default, a packet receive ring writes packets immediately following the "
"metadata structure and alignment padding. This integer option reserves "
"additional headroom."
-msgstr ""
+msgstr "デフォルトでは、パケット受信リングはメタデータ構造体とアライメント用のパディングの直後にパケットを書き込む。 この整数オプションを設定すると、パケットの前に追加で領域が予約される。"
#. type: TP
#: build/C/man7/packet.7:330
"status to B<TP_STATUS_KERNEL>. Packet sockets implement multiple variants "
"of the packet ring. The implementation details are described in "
"I<Documentation/networking/packet_mmap.txt> in the Linux kernel source tree."
-msgstr ""
+msgstr "非同期でのパケット受信用のメモリマップされたリングバッファを作成する。 パケットソケットはアプリケーションのアドレス空間に連続する領域を確保し、 そこにパケットスロットの配列を構成し、 (最大 I<tp_snaplen> 個の) パケットを順にスロットにコピーする。 各パケットの前には I<tpacket_auxdata> に似たメタデータ構造体が置かれる。 プロトコルフィールドには、データの、メタデータヘッダーの先頭からのオフセットが入る。 I<tp_net> にはネットワーク層へのオフセットが格納される。 パケットソケットが B<SOCK_DGRAM> 型の場合、 I<tp_mac> も同じである。 B<SOCK_RAW> 型の場合、 I<tp_net> にはリンク層のフレームへのオフセットが入る。 パケットソケットとアプリケーションは I<tp_status> フィールドを通してリングの先頭 (head) と末尾 (tail) の情報を受け渡す。 パケットソケットはすべてのスロットをステータス B<TP_STATUS_KERNEL> で所有しており、 スロットにデータが入ると、パケットソケットはそのスロットのステータスをアプリケーションに所有権を渡す状態に変更する。 通常の動作では、新しいステータスは B<TP_STATUS_USER> であり、これは正しく受信されたパケットが格納されたことを示している。 アプリケーションがパケットの処理を終えると、アプリケーションはそのスロットのステータスを B<TP_STATUS_KERNEL> に設定し、そのスロットの所有権をソケットに返す。 パケットソケットは、複数バージョンのパケットリングを実装している。 実装の詳細は Linux カーネルソースツリーの I<Documentation/networking/packet_mmap.txt> で説明されている。"
#. type: TP
#: build/C/man7/packet.7:370
#. type: Plain text
#: build/C/man7/packet.7:373
msgid "Retrieve packet socket statistics in the form of a structure"
-msgstr ""
+msgstr "パケットソケットの統計情報を次の構造体形式で取得する。"
#. type: Plain text
#: build/C/man7/packet.7:380
" unsigned int tp_drops; /* Dropped packet count */\n"
"};\n"
msgstr ""
+"struct tpacket_stats {\n"
+" unsigned int tp_packets; /* 総パケット数 */\n"
+" unsigned int tp_drops; /* ドロップパケット数 */\n"
+"};\n"
#. type: Plain text
#: build/C/man7/packet.7:386
msgid ""
"Receiving statistics resets the internal counters. The statistics structure "
"differs when using a ring of variant B<TPACKET_V3>."
-msgstr ""
+msgstr "統計情報を取得すると、内部カウンターはリセットされる。 B<TPACKET_V3> のリングを使う場合には、統計情報構造体は違うものになる。"
#. type: TP
#: build/C/man7/packet.7:386
#, no-wrap
msgid "B<PACKET_TIMESTAMP> (with B<PACKET_RX_RING>; since Linux 2.6.36)"
-msgstr ""
+msgstr "B<PACKET_TIMESTAMP> (B<PACKET_RX_RING> で使用; Linux 2.6.36 以降)"
#. commit 614f60fa9d73a9e8fdff3df83381907fea7c5649
#. type: Plain text
"timestamp. Besides the default, it support the two hardware formats "
"described in I<Documentation/networking/timestamping.txt> in the Linux "
"kernel source tree."
-msgstr ""
+msgstr "パケット受信リングでは常にタイムスタンプがメタデータヘッダーに格納される。 デフォルトでは、タイムスタンプはパケットがリングにコピーされた時点で生成されるソフトウェアによるタイムスタンプである。 この整数オプションによりタイムスタンプの種類を選択できる。 デフォルト以外では、 Linux カーネルソースツリーの I<Documentation/networking/timestamping.txt> に説明がある 2 種類のハードウェアフォーマットがサポートされている。"
#. type: TP
#: build/C/man7/packet.7:396
"that overrides the socket default. On successful transmission, the socket "
"resets the slot to B<TP_STATUS_AVAILABLE>. It discards packets silently on "
"error unless B<PACKET_LOSS> is set."
-msgstr ""
+msgstr "パケット送信用のメモリマップされたリングバッファを作成する。 このオプションは B<PACKET_RX_RING> と同様で、同じ引き数を取る。 アプリケーションはステータスが B<TP_STATUS_AVAILABLE> のスロットにパケットを書き込み、 B<TP_STATUS_SEND_REQUEST> にステータスを変更することでそのパケットが送信できるようにする。 パケットの送信準備ができたら、アプリケーションは続けて B<send>(2) 系のシステムコールを呼び出す。 システムコールの引き数 I<buf> と I<len> は無視される。 B<sendto>(2) や B<sendmsg>(2) を使ってアドレスが渡された場合、 ソケットのデフォルト値ではなくそのアドレスが使用される。 送信に成功すると、ソケットはそのスロットを B<TP_STATUS_AVAILABLE> に戻す。 エラーの場合、 B<PACKET_LOSS> がセットされていなければエラーなしでパケットは廃棄される。"
#. type: TP
#: build/C/man7/packet.7:425
#, no-wrap
msgid "B<PACKET_VERSION> (with B<PACKET_RX_RING>; since Linux 2.6.27)"
-msgstr ""
+msgstr "B<PACKET_VERSION> (B<PACKET_RX_RING> で使用; Linux 2.6.27 以降)"
#. commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279
#. type: Plain text
"By default, B<PACKET_RX_RING> creates a packet receive ring of variant "
"B<TPACKET_V1>. To create another variant, configure the desired variant by "
"setting this integer option before creating the ring."
-msgstr ""
+msgstr "デフォルトでは、 B<PACKET_RX_RING> は B<TPACKET_V1> のパケット受信リングを作成する。別のバージョンのリングを作成するには、そのリングを作成する前に希望するバージョンが使われるようにこの整数オプションを設定すること。"
#. type: TP
#: build/C/man7/packet.7:434
"integer option to 1. A side effect is that packet buffering in the qdisc "
"layer is avoided, which will lead to increased drops when network device "
"transmit queues are busy; therefore, use at your own risk."
-msgstr ""
+msgstr "デフォルトでは、パケットはカーネルの qdisc (トラフィック制御) レイヤー経由で渡される。 これは大半のユースケースに合っている。 ネットワークに対して可能な限りパケットを送信する (例えば pkggen と同様の方法で負荷対象のデバイスを試験する) のにパケットソケットを使うトラフィック生成アプライアンスでは、この整数オプションを 1 に設定することで qdisc レイヤーを飛ばすことができる。 qdisc レイヤーでのパケットバッファが行われなくなるという副作用がある。 これにより、 ネットワークデバイスの送信キューの使用量が高い場合にパケット廃棄が起きやすくなる。"
#. FIXME Document SIOCGSTAMPNS
#. type: Plain text
"at least one prior packet for the flow is waiting in Qdisc queues or device "
"transmit queue. Applications can still use the B<TCP_CORK> socket option to "
"obtain optimal behavior when they know how/when to uncork their sockets."
-msgstr ""
+msgstr "このオプションを有効にすると、 送信総パケット数を減らすため、 カーネルは小さな write (連続する B<write>(2) や B<sendmsg>(2) の呼び出し) を可能な限り結合しようとする。 パケットの結合が行われるのは、そのフローの前のパケットが少なくとも一つは qdisc キューかデバイスの送信キューで送信待ちの場合である。 このオプションが有効な場合でも B<TCP_CORK> オプションを使うことができ、アプリケーションがソケットの「コルク解除」(送信待ち状態の解除) をいつどのように行えばよいか分かっている場合には、最適な動作をさせることができる。"
#. type: TP
#: build/C/man7/tcp.7:321
"(B<CAP_NET_ADMIN>) can choose from any of the available congestion-control "
"algorithms (see the description of I<tcp_available_congestion_control> "
"above)."
-msgstr ""
+msgstr "このオプションの引き数は文字列である。 このオプションを使うと、呼び出し元がソケット単位に使用する TCP 輻輳制御アルゴリズムを設定することができる。 非特権プロセスが使用できるアルゴリズムは (上述の) I<tcp_allowed_congestion_control> で設定されたものだけに制限される。 特権プロセス (B<CAP_NET_ADMIN>) は任意の輻輳制御アルゴリズムを選択することができる (上記の B<tcp_available_congestion_control> の説明を参照)。"
#. type: TP
#: build/C/man7/tcp.7:922
"transmitted data may remain unacknowledged before TCP will forcibly close "
"the corresponding connection and return B<ETIMEDOUT> to the application. If "
"the option value is specified as 0, TCP will to use the system default."
-msgstr ""
+msgstr "このオプションは I<unsigned int> 型の引き数を取る。 値が 0 より大きい場合、その値は、 どのくらいの時間、送信されたデータが ACK を受信しないままの状態が続くと、 TCP がその接続を強制的にクローズし、アプリケーションに B<ETIMEDOUT> を返すかを、 ミリ秒単位で指定する。 オプションの値が 0 の場合、TCP はシステムのデフォルト値を使用する。"
#. type: Plain text
#: build/C/man7/tcp.7:1062
"applications to \"fail fast\", if so desired. Otherwise, failure may take "
"up to 20 minutes with the current system defaults in a normal WAN "
"environment."
-msgstr ""
+msgstr "ユーザータイムアウトを長くすると、 通信の両端での接続性がない場合でも長い時間 TCP 接続が維持されるようになる。 ユーザータイムアウトを短くすると、 アプリケーションは必要であれば「早く失敗」できるようになる。 設定しなかった場合は、 通常の WAN 環境では現在のシステムのデフォルトの 20 分で失敗することになる。"
#. type: Plain text
#: build/C/man7/tcp.7:1072
"with the TCP keepalive (B<SO_KEEPALIVE>) option, B<TCP_USER_TIMEOUT> will "
"override keepalive to determine when to close a connection due to keepalive "
"failure."
-msgstr ""
+msgstr "このオプションは TCP 接続がどの状態の場合でも設定することができるが、 接続が同期状態 (ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK) の場合のみ効果がある。 また、 TCP keepalive (B<SO_KEEPALIVE>) オプションとともに使用された場合、 B<TCP_USER_TIMEOUT> は keepalive 失敗による接続クローズを判定するための keepalive 値を上書きする。"
#. type: Plain text
#: build/C/man7/tcp.7:1075
msgid ""
"The option has no effect on when TCP retransmits a packet, nor when a "
"keepalive probe is sent."
-msgstr ""
+msgstr "このオプションは TCP がパケットを再送する際や keepalive プローブを送信する際には影響を及ぼさない。"
#. type: Plain text
#: build/C/man7/tcp.7:1079
msgid ""
"This option, like many others, will be inherited by the socket returned by "
"B<accept>(2), if it was set on the listening socket."
-msgstr ""
+msgstr "他の多くのオプション同様、リッスン中のソケットでこのオプションがセットされていれば B<accept>(2) が返すソケットにオプションが継承される。"
#. type: Plain text
#: build/C/man7/tcp.7:1082
msgid ""
"Further details on the user timeout feature can be found in RFC\\ 793 and RFC"
"\\ 5482 (\"TCP User Timeout Option\")."
-msgstr ""
+msgstr "ユーザータイムアウト機能の詳細は RFC\\ 793 と RFC\\ 5482 (\"TCP User Timeout Option\") に書かれている。"
#. type: TP
#: build/C/man7/tcp.7:1082
.br
\fB#include <netpacket/packet.h>\fP
.br
-\fB#include <net/ethernet.h> /* the L2 protocols */\fP
+\fB#include <net/ethernet.h> /* L2 プロトコル */\fP
.sp
\fBpacket_socket = socket(AF_PACKET, int \fP\fIsocket_type\fP\fB, int \fP\fIprotocol\fP\fB);\fP
.fi
.TP
\fBPACKET_AUXDATA\fP (Linux 2.6.21 以降)
.\" commit 8dc4194474159660d7f37c495e3fc3f10d0db8cc
-If this binary option is enabled, the packet socket passes a metadata
-structure along with each packet in the \fBrecvmsg\fP(2) control field. The
-structure can be read with \fBcmsg\fP(3). It is defined as
+ブール値のオプションを有効すると、 パケットソケットは、パケットと一緒にメタデータ構造体を \fBrecvmsg\fP(2) コントロールフィールドで渡す。
+この構造体は \fBcmsg\fP(3) を使って読むことができる。 定義は以下の通りである。
.in +4n
.nf
struct tpacket_auxdata {
__u32 tp_status;
- __u32 tp_len; /* packet length */
- __u32 tp_snaplen; /* captured length */
+ __u32 tp_len; /* パケット長 */
+ __u32 tp_snaplen; /* キャプチャした長さ */
__u16 tp_mac;
__u16 tp_net;
__u16 tp_vlan_tci;
.TP
\fBPACKET_FANOUT\fP (Linux 3.1 以降)
.\" commit dc99f600698dcac69b8f56dda9a8a00d645c5ffc
-To scale processing across threads, packet sockets can form a fanout group.
-In this mode, each matching packet is enqueued onto only one socket in the
-group. A socket joins a fanout group by calling \fBsetsockopt\fP(2) with
-level \fBSOL_PACKET\fP and option \fBPACKET_FANOUT\fP. Each network namespace can
-have up to 65536 independent groups. A socket selects a group by encoding
-the ID in the first 16 bits of the integer option value. The first packet
-socket to join a group implicitly creates it. To successfully join an
-existing group, subsequent packet sockets must have the same protocol,
-device settings, fanout mode and flags (see below). Packet sockets can
-leave a fanout group only by closing the socket. The group is deleted when
-the last socket is closed.
+スレッドにまたがって処理をスケールさせるため、 パケットソケットはファンアウトグループを構成することができる。 このモードでは、
+マッチしたそれぞれのパケットはグループ内のいずれか一つのソケットにだけキューイングされる。 ソケットをファンアウトグループに参加させるには、 レベル
+\fBSOL_PACKET\fP でオプション \fBPACKET_FANOUT\fP を指定して \fBsetsockopt\fP(2) を呼び出す。
+ネットワーク名前空間毎に最大 65536 個の独立したグループを持つことができる。 整数のオプション値の先頭 16 ビットに ID
+をエンコードすることで、 ソケットはグループを選択する。 あるグループへの最初のパケットソケットの参加があった時点で、
+グループは暗黙のうちに作成される。 既存のグループへの参加が成功するためには、 それ以降にそのグループに参加しようとするパケットソケットは、
+プロトコロ、 デバイス設定、ファンアウトモード、フラグが同じである必要がある (下記参照)。 パケットソケットがファンアウトグループから抜けるのは、
+そのソケットをクローズした場合だけである。 ファンアウトグループは最後のソケットがクローズした場合に削除される。
.\" commit 2d36097d26b5991d71a2cf4a20c1a158f0f1bfcd
-Fanout supports multiple algorithms to spread traffic between sockets. The
-default mode, \fBPACKET_FANOUT_HASH\fP, sends packets from the same flow to the
-same socket to maintain per\-flow ordering. For each packet, it chooses a
-socket by taking the packet flow hash modulo the number of sockets in the
-group, where a flow hash is a hash over network\-layer address and optional
-transport\-layer port fields. The load\-balance mode \fBPACKET_FANOUT_LB\fP
-implements a round\-robin algorithm. \fBPACKET_FANOUT_CPU\fP selects the socket
-based on the CPU that the packet arrived on. \fBPACKET_FANOUT_ROLLOVER\fP
-processes all data on a single socket, moves to the next when one becomes
-backlogged. \fBPACKET_FANOUT_RND\fP selects the socket using a pseudo\-random
-number generator. \fBPACKET_FANOUT_QM\fP (available since Linux 3.14) selects
-the socket using the recorded queue_mapping of the received skb.
-
-Fanout modes can take additional options. IP fragmentation causes packets
-from the same flow to have different flow hashes. The flag
-\fBPACKET_FANOUT_FLAG_DEFRAG\fP, if set, causes packet to be defragmented
-before fanout is applied, to preserve order even in this case. Fanout mode
-and options are communicated in the second 16 bits of the integer option
-value. The flag \fBPACKET_FANOUT_FLAG_ROLLOVER\fP enables the roll over
-mechanism as a backup strategy: if the original fanout algorithm selects a
-backlogged socket, the packet rolls over to the next available one.
+ファンアウトでは、 複数のソケットにトラフィックを分散させるアルゴリズムを複数サポートしている。 デフォルトのモードである
+\fBPACKET_FANOUT_HASH\fP では、同じフローのパケットは同じソケットに送信され、 フロー単位の順序が維持される。
+パケットごとに、パケットフローのハッシュの、そのグループのソケット数に対する剰余が計算され、ソケットが選択される。
+なお、フローハッシュはネットワーク層のアドレスとトランスポート層のポートフィールドに対するハッシュである (トランスポート層ポートは存在する場合のみ)。
+負荷分散モード \fBPACKET_FANOUT_LB\fP はラウンドロビンアルゴリズムが採用されている。 \fBPACKET_FANOUT_CPU\fP では、
+パケットが到着した CPU に基づいてソケットを選択する。 \fBPACKET_FANOUT_ROLLOVER\fP
+はすべてのデータを一つのソケットで処理し、 そのソケットで処理待ち (backlog) が発生した場合に次のソケットに移る。
+\fBPACKET_FANOUT_RND\fP では擬似乱数発生器を使ってソケットが選択される。 \fBPACKET_FANOUT_QM\fP (Linux
+3.14 以降で利用可能) では受信 skb に記録された queue_mapping を使ってソケットが選択される。
+
+ファンアウトモードでは追加のオプションがある。 IP フラグメンテーションが起こると、
+同じフローのパケットのフローハッシュが異なるハッシュを持つことになる。 フラグ \fBPACKET_FANOUT_FLAG_DEFRAG\fP
+をセットすると、 パケットはファンアウトを行う前にフラグメント再構築が行われるようになり、 フラグメントがあった場合でも順序が維持される。
+ファンアウトモードとオプションは、 整数のオプション値の下位 16 ビットで指定される。 フラグ
+\fBPACKET_FANOUT_FLAG_ROLLOVER\fP を指定すると、 バックアップ戦略としてロールオーバー方式が有効になる。
+元のファンアウトアルゴリズムが backlog ソケットを選択していれば、 パケットは次の利用可能なソケットにロールオーバーされる。
.TP
-\fBPACKET_LOSS\fP (with \fBPACKET_TX_RING\fP)
-If set, do not silently drop a packet on transmission error, but return it
-with status set to \fBTP_STATUS_WRONG_FORMAT\fP.
+\fBPACKET_LOSS\fP (\fBPACKET_TX_RING\fP で使用)
+有効にすると、転送エラーの場合にパケットをエラーなしに黙って破棄せず、 ステータスを \fBTP_STATUS_WRONG_FORMAT\fP
+にセットして返る。
.TP
-\fBPACKET_RESERVE\fP (with \fBPACKET_RX_RING\fP)
-By default, a packet receive ring writes packets immediately following the
-metadata structure and alignment padding. This integer option reserves
-additional headroom.
+\fBPACKET_RESERVE\fP (\fBPACKET_RX_RING\fP で使用)
+デフォルトでは、パケット受信リングはメタデータ構造体とアライメント用のパディングの直後にパケットを書き込む。
+この整数オプションを設定すると、パケットの前に追加で領域が予約される。
.TP
\fBPACKET_RX_RING\fP
-Create a memory\-mapped ring buffer for asynchronous packet reception. The
-packet socket reserves a contiguous region of application address space,
-lays it out into an array of packet slots and copies packets (up to
-\fItp_snaplen\fP) into subsequent slots. Each packet is preceded by a
-metadata structure similar to \fItpacket_auxdata\fP. The protocol fields
-encode the offset to the data from the start of the metadata header.
-\fItp_net\fP stores the offset to the network layer. If the packet socket is
-of type \fBSOCK_DGRAM\fP, then \fItp_mac\fP is the same. If it is of type
-\fBSOCK_RAW\fP, then that field stores the offset to the link\-layer frame.
-Packet socket and application communicate the head and tail of the ring
-through the \fItp_status\fP field. The packet socket owns all slots with
-status \fBTP_STATUS_KERNEL\fP. After filling a slot, it changes the status of
-the slot to transfer ownership to the application. During normal operation,
-the new status is \fBTP_STATUS_USER\fP, to signal that a correctly received
-packet has been stored. When the application has finished processing a
-packet, it transfers ownership of the slot back to the socket by setting the
-status to \fBTP_STATUS_KERNEL\fP. Packet sockets implement multiple variants
-of the packet ring. The implementation details are described in
-\fIDocumentation/networking/packet_mmap.txt\fP in the Linux kernel source tree.
+非同期でのパケット受信用のメモリマップされたリングバッファを作成する。 パケットソケットはアプリケーションのアドレス空間に連続する領域を確保し、
+そこにパケットスロットの配列を構成し、 (最大 \fItp_snaplen\fP 個の) パケットを順にスロットにコピーする。 各パケットの前には
+\fItpacket_auxdata\fP に似たメタデータ構造体が置かれる。
+プロトコルフィールドには、データの、メタデータヘッダーの先頭からのオフセットが入る。 \fItp_net\fP にはネットワーク層へのオフセットが格納される。
+パケットソケットが \fBSOCK_DGRAM\fP 型の場合、 \fItp_mac\fP も同じである。 \fBSOCK_RAW\fP 型の場合、 \fItp_net\fP
+にはリンク層のフレームへのオフセットが入る。 パケットソケットとアプリケーションは \fItp_status\fP フィールドを通してリングの先頭
+(head) と末尾 (tail) の情報を受け渡す。 パケットソケットはすべてのスロットをステータス \fBTP_STATUS_KERNEL\fP
+で所有しており、 スロットにデータが入ると、パケットソケットはそのスロットのステータスをアプリケーションに所有権を渡す状態に変更する。
+通常の動作では、新しいステータスは \fBTP_STATUS_USER\fP であり、これは正しく受信されたパケットが格納されたことを示している。
+アプリケーションがパケットの処理を終えると、アプリケーションはそのスロットのステータスを \fBTP_STATUS_KERNEL\fP
+に設定し、そのスロットの所有権をソケットに返す。 パケットソケットは、複数バージョンのパケットリングを実装している。 実装の詳細は Linux
+カーネルソースツリーの \fIDocumentation/networking/packet_mmap.txt\fP で説明されている。
.TP
\fBPACKET_STATISTICS\fP
-Retrieve packet socket statistics in the form of a structure
+パケットソケットの統計情報を次の構造体形式で取得する。
.in +4n
.nf
struct tpacket_stats {
- unsigned int tp_packets; /* Total packet count */
- unsigned int tp_drops; /* Dropped packet count */
+ unsigned int tp_packets; /* 総パケット数 */
+ unsigned int tp_drops; /* ドロップパケット数 */
};
.fi
.in
-Receiving statistics resets the internal counters. The statistics structure
-differs when using a ring of variant \fBTPACKET_V3\fP.
+統計情報を取得すると、内部カウンターはリセットされる。 \fBTPACKET_V3\fP のリングを使う場合には、統計情報構造体は違うものになる。
.TP
-\fBPACKET_TIMESTAMP\fP (with \fBPACKET_RX_RING\fP; since Linux 2.6.36)
+\fBPACKET_TIMESTAMP\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.36 以降)
.\" commit 614f60fa9d73a9e8fdff3df83381907fea7c5649
-The packet receive ring always stores a timestamp in the metadata header.
-By default, this is a software generated timestamp generated when the packet
-is copied into the ring. This integer option selects the type of
-timestamp. Besides the default, it support the two hardware formats
-described in \fIDocumentation/networking/timestamping.txt\fP in the Linux
-kernel source tree.
+パケット受信リングでは常にタイムスタンプがメタデータヘッダーに格納される。
+デフォルトでは、タイムスタンプはパケットがリングにコピーされた時点で生成されるソフトウェアによるタイムスタンプである。
+この整数オプションによりタイムスタンプの種類を選択できる。 デフォルト以外では、 Linux カーネルソースツリーの
+\fIDocumentation/networking/timestamping.txt\fP に説明がある 2
+種類のハードウェアフォーマットがサポートされている。
.TP
\fBPACKET_TX_RING\fP (Linux 2.6.31 以降)
.\" commit 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1
-Create a memory\-mapped ring buffer for packet transmission. This option is
-similar to \fBPACKET_RX_RING\fP and takes the same arguments. The application
-writes packets into slots with status \fBTP_STATUS_AVAILABLE\fP and schedules
-them for transmission by changing the status to \fBTP_STATUS_SEND_REQUEST\fP.
-When packets are ready to be transmitted, the application calls \fBsend\fP(2)
-or a variant thereof. The \fIbuf\fP and \fIlen\fP fields of this call are
-ignored. If an address is passed using \fBsendto\fP(2) or \fBsendmsg\fP(2), then
-that overrides the socket default. On successful transmission, the socket
-resets the slot to \fBTP_STATUS_AVAILABLE\fP. It discards packets silently on
-error unless \fBPACKET_LOSS\fP is set.
+パケット送信用のメモリマップされたリングバッファを作成する。 このオプションは \fBPACKET_RX_RING\fP と同様で、同じ引き数を取る。
+アプリケーションはステータスが \fBTP_STATUS_AVAILABLE\fP のスロットにパケットを書き込み、
+\fBTP_STATUS_SEND_REQUEST\fP にステータスを変更することでそのパケットが送信できるようにする。
+パケットの送信準備ができたら、アプリケーションは続けて \fBsend\fP(2) 系のシステムコールを呼び出す。 システムコールの引き数 \fIbuf\fP と
+\fIlen\fP は無視される。 \fBsendto\fP(2) や \fBsendmsg\fP(2) を使ってアドレスが渡された場合、
+ソケットのデフォルト値ではなくそのアドレスが使用される。 送信に成功すると、ソケットはそのスロットを \fBTP_STATUS_AVAILABLE\fP
+に戻す。 エラーの場合、 \fBPACKET_LOSS\fP がセットされていなければエラーなしでパケットは廃棄される。
.TP
-\fBPACKET_VERSION\fP (with \fBPACKET_RX_RING\fP; since Linux 2.6.27)
+\fBPACKET_VERSION\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.27 以降)
.\" commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279
-By default, \fBPACKET_RX_RING\fP creates a packet receive ring of variant
-\fBTPACKET_V1\fP. To create another variant, configure the desired variant by
-setting this integer option before creating the ring.
+デフォルトでは、 \fBPACKET_RX_RING\fP は \fBTPACKET_V1\fP
+のパケット受信リングを作成する。別のバージョンのリングを作成するには、そのリングを作成する前に希望するバージョンが使われるようにこの整数オプションを設定すること。
.TP
\fBPACKET_QDISC_BYPASS\fP (Linux 3.14 以降)
.\" commit d346a3fae3ff1d99f5d0c819bf86edf9094a26a1
-By default, packets sent through packet sockets pass through the kernel's
-qdisc (traffic control) layer, which is fine for the vast majority of use
-cases. For traffic generator appliances using packet sockets that intend to
-brute\-force flood the network\(emfor example, to test devices under load in
-a similar fashion to pktgen\(emthis layer can be bypassed by setting this
-integer option to 1. A side effect is that packet buffering in the qdisc
-layer is avoided, which will lead to increased drops when network device
-transmit queues are busy; therefore, use at your own risk.
+デフォルトでは、パケットはカーネルの qdisc (トラフィック制御) レイヤー経由で渡される。 これは大半のユースケースに合っている。
+ネットワークに対して可能な限りパケットを送信する (例えば pkggen と同様の方法で負荷対象のデバイスを試験する)
+のにパケットソケットを使うトラフィック生成アプライアンスでは、この整数オプションを 1 に設定することで qdisc レイヤーを飛ばすことができる。
+qdisc レイヤーでのパケットバッファが行われなくなるという副作用がある。 これにより、
+ネットワークデバイスの送信キューの使用量が高い場合にパケット廃棄が起きやすくなる。
.SS ioctl
.\" FIXME Document SIOCGSTAMPNS
\fBSIOCGSTAMP\fP を用いると、最後に受信したパケットのタイムスタンプを得ることができる。 引き数は \fIstruct timeval\fP
\fItcp_autocorking\fP (ブール値; デフォルト: 有効; Linux 3.14 以降)
.\" commit f54b311142a92ea2e42598e347b84e1655caf8e3
.\" Text heavily based on Documentation/networking/ip-sysctl.txt
-If this option is enabled, the kernel tries to coalesce small writes (from
-consecutive \fBwrite\fP(2) and \fBsendmsg\fP(2) calls) as much as possible, in
-order to decrease the total number of sent packets. Coalescing is done if
-at least one prior packet for the flow is waiting in Qdisc queues or device
-transmit queue. Applications can still use the \fBTCP_CORK\fP socket option to
-obtain optimal behavior when they know how/when to uncork their sockets.
+このオプションを有効にすると、 送信総パケット数を減らすため、 カーネルは小さな write (連続する \fBwrite\fP(2) や
+\fBsendmsg\fP(2) の呼び出し) を可能な限り結合しようとする。 パケットの結合が行われるのは、そのフローの前のパケットが少なくとも一つは
+qdisc キューかデバイスの送信キューで送信待ちの場合である。 このオプションが有効な場合でも \fBTCP_CORK\fP
+オプションを使うことができ、アプリケーションがソケットの「コルク解除」(送信待ち状態の解除)
+をいつどのように行えばよいか分かっている場合には、最適な動作をさせることができる。
.TP
\fItcp_available_congestion_control\fP (String; read\-only; Linux 2.4.20 以降)
.\" The following is from 2.6.28-rc4: Documentation/networking/ip-sysctl.txt
\fBTCP_CONGESTION\fP (Linux 2.6.13 以降)
.\" commit 5f8ef48d240963093451bcf83df89f1a1364f51d
.\" Author: Stephen Hemminger <shemminger@osdl.org>
-The argument for this option is a string. This option allows the caller to
-set the TCP congestion control algorithm to be used, on a per\-socket basis.
-Unprivileged processes are restricted to choosing one of the algorithms in
-\fItcp_allowed_congestion_control\fP (described above). Privileged processes
-(\fBCAP_NET_ADMIN\fP) can choose from any of the available congestion\-control
-algorithms (see the description of \fItcp_available_congestion_control\fP
-above).
+このオプションの引き数は文字列である。 このオプションを使うと、呼び出し元がソケット単位に使用する TCP 輻輳制御アルゴリズムを設定することができる。
+非特権プロセスが使用できるアルゴリズムは (上述の) \fItcp_allowed_congestion_control\fP
+で設定されたものだけに制限される。 特権プロセス (\fBCAP_NET_ADMIN\fP) は任意の輻輳制御アルゴリズムを選択することができる (上記の
+\fBtcp_available_congestion_control\fP の説明を参照)。
.TP
\fBTCP_CORK\fP (Linux 2.2 以降)
.\" precisely: since 2.1.127
.\" The following text taken nearly verbatim from Jerry Chu's (excellent)
.\" commit message.
.\"
-This option takes an \fIunsigned int\fP as an argument. When the value is
-greater than 0, it specifies the maximum amount of time in milliseconds that
-transmitted data may remain unacknowledged before TCP will forcibly close
-the corresponding connection and return \fBETIMEDOUT\fP to the application. If
-the option value is specified as 0, TCP will to use the system default.
+このオプションは \fIunsigned int\fP 型の引き数を取る。 値が 0 より大きい場合、その値は、 どのくらいの時間、送信されたデータが ACK
+を受信しないままの状態が続くと、 TCP がその接続を強制的にクローズし、アプリケーションに \fBETIMEDOUT\fP を返すかを、
+ミリ秒単位で指定する。 オプションの値が 0 の場合、TCP はシステムのデフォルト値を使用する。
-Increasing user timeouts allows a TCP connection to survive extended periods
-without end\-to\-end connectivity. Decreasing user timeouts allows
-applications to "fail fast", if so desired. Otherwise, failure may take up
-to 20 minutes with the current system defaults in a normal WAN environment.
+ユーザータイムアウトを長くすると、 通信の両端での接続性がない場合でも長い時間 TCP 接続が維持されるようになる。 ユーザータイムアウトを短くすると、
+アプリケーションは必要であれば「早く失敗」できるようになる。 設定しなかった場合は、 通常の WAN 環境では現在のシステムのデフォルトの 20
+分で失敗することになる。
-This option can be set during any state of a TCP connection, but is only
-effective during the synchronized states of a connection (ESTABLISHED,
-FIN\-WAIT\-1, FIN\-WAIT\-2, CLOSE\-WAIT, CLOSING, and LAST\-ACK). Moreover, when
-used with the TCP keepalive (\fBSO_KEEPALIVE\fP) option, \fBTCP_USER_TIMEOUT\fP
-will override keepalive to determine when to close a connection due to
-keepalive failure.
+このオプションは TCP 接続がどの状態の場合でも設定することができるが、 接続が同期状態 (ESTABLISHED, FIN\-WAIT\-1,
+FIN\-WAIT\-2, CLOSE\-WAIT, CLOSING, LAST\-ACK) の場合のみ効果がある。 また、 TCP keepalive
+(\fBSO_KEEPALIVE\fP) オプションとともに使用された場合、 \fBTCP_USER_TIMEOUT\fP は keepalive
+失敗による接続クローズを判定するための keepalive 値を上書きする。
-The option has no effect on when TCP retransmits a packet, nor when a
-keepalive probe is sent.
+このオプションは TCP がパケットを再送する際や keepalive プローブを送信する際には影響を及ぼさない。
-This option, like many others, will be inherited by the socket returned by
-\fBaccept\fP(2), if it was set on the listening socket.
+他の多くのオプション同様、リッスン中のソケットでこのオプションがセットされていれば \fBaccept\fP(2) が返すソケットにオプションが継承される。
-Further details on the user timeout feature can be found in RFC\ 793 and
-RFC\ 5482 ("TCP User Timeout Option").
+ユーザータイムアウト機能の詳細は RFC\ 793 と RFC\ 5482 ("TCP User Timeout Option") に書かれている。
.TP
\fBTCP_WINDOW_CLAMP\fP (Linux 2.4 以降)
.\" Precisely: since 2.3.41
getaddrinfo_a.3,81,41,122
inet_net_pton.3,54,38,92
nss.5,20,7,27
-packet.7,94,19,113
-tcp.7,248,8,256
○:LDP man-pages:3.65:2013/03/15:netlink:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI:
○:LDP man-pages:3.65:2012/08/05:numa:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI:
○:LDP man-pages:3.65:2011/09/09:operator:7:2014/04/24::ysato444@yahoo.co.jp:Yuichi SATO:
-â\98\86:LDP man-pages:3.54=>3.65:2014/02/26:packet:7:2013/03/26::amotoki@gmail.com:Akihiro MOTOKI:
+â\97\8b:LDP man-pages:3.65:2014/02/26:packet:7:2014/04/27::amotoki@gmail.com:Akihiro MOTOKI:
○:LDP man-pages:3.65:2009/12/05:path_resolution:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI:
○:LDP man-pages:3.65:2005/12/08:pipe:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI:
○:LDP man-pages:3.65:2007/12/21:posixoptions:7:2014/04/24::ysato444@yahoo.co.jp:Yuichi SATO:
○:LDP man-pages:3.65:2000/11/16:suffixes:7:2014/04/24::ysato@h4.dion.ne.jp:Yuichi SATO:
○:LDP man-pages:3.65:2013/02/12:svipc:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI:
×:LDP man-pages:3.65:2014/04/06:symlink:7:::::
-â\98\86:LDP man-pages:3.54=>3.65:2014/03/31:tcp:7:2013/07/24::amotoki@gmail.com:Akihiro MOTOKI:
+â\97\8b:LDP man-pages:3.65:2014/03/31:tcp:7:2014/04/27::amotoki@gmail.com:Akihiro MOTOKI:
○:LDP man-pages:3.65:2013/02/12:termio:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI:
○:LDP man-pages:3.65:2012/10/28:time:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI:
@:LDP man-pages:3.65:2014/02/16:tis-620:7:iso_8859-11:7:
<TR><TD>getaddrinfo_a.3</TD><TD>41/122</TD><TD>66.39</TD></TR>
<TR><TD>inet_net_pton.3</TD><TD>38/92</TD><TD>58.70</TD></TR>
<TR class="over70"><TD>nss.5</TD><TD>7/27</TD><TD>74.07</TD></TR>
-<TR class="over80"><TD>packet.7</TD><TD>19/113</TD><TD>83.19</TD></TR>
-<TR class="over80"><TD>tcp.7</TD><TD>8/256</TD><TD>96.88</TD></TR>
<TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>process</B></TD></TR>
<TR><TD>cpuset.7</TD><TD>212/314</TD><TD>32.48</TD></TR>
<TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>signal</B></TD></TR>
<TR class="over70"><TD>futimesat.2</TD><TD>10/37</TD><TD>72.97</TD></TR>
<TR><TD>utimensat.2</TD><TD>49/107</TD><TD>54.21</TD></TR>
<TR class="over80"><TD>zdump.8</TD><TD>1/22</TD><TD>95.45</TD></TR>
-<TR><TD COLSPAN=3>Total 64 pages</TD></TR>
+<TR><TD COLSPAN=3>Total 62 pages</TD></TR>
</TABLE>
</BODY></HTML>