OSDN Git Service

6b2f0ffc648efdb3301f766150513c641afabd03
[linuxjm/LDP_man-pages.git] / draft / man7 / netdevice.7
1 '\" t
2 .\" Don't change the first line, it tells man that tbl is needed.
3 .\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
4 .\" Permission is granted to distribute possibly modified copies
5 .\" of this page provided the header is included verbatim,
6 .\" and in case of nontrivial modification author and date
7 .\" of the modification is added to the header.
8 .\" $Id: netdevice.7,v 1.10 2001/08/15 18:01:06 hanataka Exp $
9 .\"
10 .\" Modified, 2004-11-25, mtk, formatting and a few wording fixes
11 .\"
12 .\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved.
13 .\" Translated Mon 6 Dec 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
14 .\" Updated Wed 14 Feb 2001 by Kentaro Shirakata <argrath@ub32.org>
15 .\" Updated 2009-02-12 by Kentaro Shirakata <argrath@ub32.org>
16 .\"
17 .\"WORD         load balancing bundle   負荷分散グループ
18 .\"WORD         file descriptor         ファイルディスクリプタ
19 .\"WORD         capability              権限
20 .\"
21 .TH NETDEVICE  7 2009-01-14 "Linux" "Linux Programmer's Manual"
22 .\"O .SH NAME
23 .\"O netdevice \- Low level access to Linux network devices
24 .SH 名前
25 netdevice \- Linux ネットワークデバイスへの低レベルアクセス
26 .\"O .SH SYNOPSIS
27 .SH 書式
28 .B "#include <sys/ioctl.h>"
29 .br
30 .B "#include <net/if.h>"
31 .\"O .SH DESCRIPTION
32 .SH 説明
33 .\"O This man page describes the sockets interface which is used to configure
34 .\"O network devices.
35 この man ページでは、ネットワークデバイスを設定するために
36 用いるソケットインターフェースについて解説する。
37
38 .\"O Linux supports some standard ioctls to configure network devices.
39 .\"O They can be used on any socket's file descriptor regardless of the
40 .\"O family or type.
41 .\"O They pass an
42 .\"O . ifreq
43 .\"O structure:
44 Linux はネットワークデバイスを設定するための標準的な ioctl を
45 いくつか備えている。これらはどんなソケットのファイルディスクリプタにも
46 用いることができる。ファミリーやタイプは何でもよい。
47 これらの ioctl は
48 .I ifreq
49 構造体を渡す。
50
51 .in +4n
52 .nf
53 struct ifreq {
54     char ifr_name[IFNAMSIZ]; /* Interface name */
55     union {
56         struct sockaddr ifr_addr;
57         struct sockaddr ifr_dstaddr;
58         struct sockaddr ifr_broadaddr;
59         struct sockaddr ifr_netmask;
60         struct sockaddr ifr_hwaddr;
61         short           ifr_flags;
62         int             ifr_ifindex;
63         int             ifr_metric;
64         int             ifr_mtu;
65         struct ifmap    ifr_map;
66         char            ifr_slave[IFNAMSIZ];
67         char            ifr_newname[IFNAMSIZ];
68         char           *ifr_data;
69     };
70 };
71
72 struct ifconf {
73     int                 ifc_len; /* size of buffer */
74     union {
75         char           *ifc_buf; /* buffer address */
76         struct ifreq   *ifc_req; /* array of structures */
77     };
78 };
79 .fi
80 .in
81
82 .\"O Normally, the user specifies which device to affect by setting
83 .\"O .I ifr_name
84 .\"O to the name of the interface.
85 .\"O All other members of the structure may
86 .\"O share memory.
87 通常、ユーザーによる設定対象デバイスの指定は、
88 .I ifr_name
89 にインターフェースの名前をセットすることによって行う。
90 他の構造体の全てのメンバは、メモリを共有する。
91 .\"O .SS Ioctls
92 .SS ioctl
93 .\"O If an ioctl is marked as privileged then using it requires an effective
94 .\"O user ID of 0 or the
95 .\"O .B CAP_NET_ADMIN
96 .\"O capability.
97 .\"O If this is not the case
98 .\"O .B EPERM
99 .\"O will be returned.
100 「特権が必要」と記述されている ioctl を実行するには、
101 実効ユーザー ID が 0 か、
102 .B CAP_NET_ADMIN
103 権限が必要である。これが満たされていない場合は
104 .B EPERM
105 が返される。
106 .TP
107 .B SIOCGIFNAME
108 .\"O Given the
109 .\"O .IR ifr_ifindex ,
110 .\"O return the name of the interface in
111 .\"O .IR ifr_name .
112 .\"O This is the only ioctl which returns its result in
113 .\"O .IR ifr_name .
114 .I ifr_ifindex
115 を受け取り、インターフェースの名前を
116 .I ifr_name
117 に入れて返す。これは結果を
118 .I ifr_name
119 として返す唯一の ioctl である。
120 .TP
121 .B SIOCGIFINDEX
122 .\"O Retrieve the interface index of the interface into
123 .\"O .IR ifr_ifindex .
124 インターフェースの interface index を取得し、
125 .I ifr_ifindex
126 に入れて返す。
127 .TP
128 .BR SIOCGIFFLAGS ", " SIOCSIFFLAGS
129 .\"O Get or set the active flag word of the device.
130 .\"O .I ifr_flags
131 .\"O contains a bit mask of the following values:
132 デバイスの active フラグワードを取得または設定する。
133 .I ifr_flags
134 には以下の値のビットマスクが入る。
135 .TS
136 tab(:);
137 c s
138 l l.
139 .\"O Device flags
140 .\"O IFF_UP:Interface is running.
141 .\"O IFF_BROADCAST:Valid broadcast address set.
142 .\"O IFF_DEBUG:Internal debugging flag.
143 .\"O IFF_LOOPBACK:Interface is a loopback interface.
144 .\"O IFF_POINTOPOINT:Interface is a point-to-point link.
145 .\"O IFF_RUNNING:Resources allocated.
146 .\"O IFF_NOARP:No arp protocol
147 .\"O IFF_PROMISC:Interface is in promiscuous mode.
148 .\"O IFF_NOTRAILERS:Avoid use of trailers.
149 .\"O IFF_ALLMULTI:Receive all multicast packets.
150 .\"O IFF_MASTER:Master of a load balancing bundle.
151 .\"O IFF_SLAVE:Slave of a load balancing bundle.
152 .\"O IFF_MULTICAST:Supports multicast
153 .\"O IFF_PORTSEL:Is able to select media type via ifmap.
154 .\"O IFF_AUTOMEDIA:Auto media selection active.
155 .\"O IFF_DYNAMIC:T{
156 .\"O The addresses are lost when the interface goes down.
157 .\"O T}
158 .\"O IFF_LOWER_UP:Driver signals L1 up (since Linux 2.6.17)
159 .\"O IFF_DORMANT:Driver signals dormant (since Linux 2.6.17)
160 .\"O IFF_ECHO:Echo sent packets (since Linux 2.6.25)
161 デバイスフラグ
162 IFF_UP:インターフェースは動作中。
163 IFF_BROADCAST:T{
164 有効なブロードキャストアドレスがセットされている。
165 T}
166 IFF_DEBUG:内部のデバッグフラグ。
167 IFF_LOOPBACK:インターフェースはループバックである。
168 IFF_POINTOPOINT:T{
169 インターフェースは point-to-point リンクである。
170 T}
171 IFF_RUNNING:リソースが割り当て済み。
172 IFF_NOARP:arp プロトコルがない。
173 IFF_PROMISC:インターフェースは promiscuous モードである。
174 IFF_NOTRAILERS:trailer の利用を避ける。
175 IFF_ALLMULTI:全てのマルチキャストパケットを受信する。
176 IFF_MASTER:負荷分散グループのマスターである。
177 IFF_SLAVE:負荷分散グループのスレーブである。
178 IFF_MULTICAST:マルチキャストをサポートしている。
179 IFF_PORTSEL:ifmap によってメディアタイプを選択できる。
180 IFF_AUTOMEDIA:自動メディア選択が有効になっている。
181 IFF_DYNAMIC:T{
182 このインターフェースが閉じると、アドレスは失われる。
183 T}
184 IFF_LOWER_UP:ドライバからの L1 アップの通知 (Linux 2.6.17 以降)
185 IFF_DORMANT:ドライバからの休止状態の通知 (Linux 2.6.17 以降)
186 IFF_ECHO:送られたパケットをエコーする (Linux 2.6.25 以降)
187
188
189 .TE
190 .\"O Setting the active flag word is a privileged operation, but any
191 .\"O process may read it.
192 active フラグワードの設定は特権が必要な操作である。
193 しかし読み出しはどんなプロセスからも可能である。
194 .TP
195 .BR SIOCGIFMETRIC ", " SIOCSIFMETRIC
196 .\"O Get or set the metric of the device using
197 .\"O .IR ifr_metric .
198 .\"O This is currently not implemented; it sets
199 .\"O .I ifr_metric
200 .\"O to 0 if you attempt to read it and returns
201 .\"O .B EOPNOTSUPP
202 .\"O if you attempt to set it.
203 デバイスのメトリックを
204 .I ifr_metric
205 を用いて取得・設定する。
206 これはまだ実装されていない。読み出そうとすると
207 .I ifr_metric
208 に 0 をセットして返り、設定しようとすると
209 .B EOPNOTSUPP
210 が返る。
211 .TP
212 .BR SIOCGIFMTU ", " SIOCSIFMTU
213 .\"O Get or set the MTU (Maximum Transfer Unit) of a device using
214 .\"O .IR ifr_mtu .
215 .\"O Setting the MTU is a privileged operation.
216 .\"O Setting the MTU to
217 .\"O too small values may cause kernel crashes.
218 デバイスの MTU (Maximum Transfer Unit) を
219 .I ifr_mtu
220 を用いて取得・設定する。 MTU の設定は特権が必要な操作である。
221 MTU の値を小さくしすぎるとカーネルがクラッシュするかもしれない。
222 .TP
223 .BR SIOCGIFHWADDR ", " SIOCSIFHWADDR
224 .\"O Get or set the hardware address of a device using
225 .\"O .IR ifr_hwaddr .
226 デバイスのハードウェアアドレスを
227 .I ifr_hwaddr
228 を用いて取得・設定する。
229 .\"O The hardware address is specified in a struct
230 .\"O .IR sockaddr .
231 ハードウェアアドレスは
232 .I sockaddr
233 構造体に設定される。
234 .\"O .I sa_family
235 .\"O contains the ARPHRD_* device type,
236 .\"O .I sa_data
237 .\"O the L2 hardware address starting from byte 0.
238 .I sa_family
239 には ARPHRD_* デバイスタイプが入り、
240 .I sa_data
241 にはバイト 0 から始まる L2 ハードウェアアドレスが入る。
242 .\"O Setting the hardware address is a privileged operation.
243 ハードウェアアドレスの設定は特権が必要な操作である。
244 .TP
245 .B SIOCSIFHWBROADCAST
246 .\"O Set the hardware broadcast address of a device from
247 .\"O .IR ifr_hwaddr .
248 .\"O This is a privileged operation.
249 デバイスのハードウェアブロードキャストアドレスを
250 .I ifr_hwaddr
251 の値に設定する。この操作には特権が必要である。
252 .TP
253 .BR SIOCGIFMAP ", " SIOCSIFMAP
254 .\"O Get or set the interface's hardware parameters using
255 .\"O .IR ifr_map .
256 .\"O Setting the parameters is a privileged operation.
257 インターフェースのハードウェアのパラメータを
258 .I ifr_map
259 を用いて取得・設定する。
260 パラメータの設定は特権が必要な操作である。
261
262 .in +4n
263 .nf
264 struct ifmap {
265     unsigned long   mem_start;
266     unsigned long   mem_end;
267     unsigned short  base_addr;
268     unsigned char   irq;
269     unsigned char   dma;
270     unsigned char   port;
271 };
272 .fi
273 .in
274
275 .\"O The interpretation of the ifmap structure depends on the device driver
276 .\"O and the architecture.
277 ifmap 構造体の解釈はデバイスドライバとアーキテクチャに依存する。
278 .TP
279 .BR SIOCADDMULTI ", " SIOCDELMULTI
280 .\"O Add an address to or delete an address from the device's link layer
281 .\"O multicast filters using
282 .\"O .IR ifr_hwaddr .
283 .\"O These are privileged operations.
284 .\"O See also
285 .\"O .BR packet (7)
286 .\"O for an alternative.
287 デバイスのリンク層のマルチキャストフィルターから、
288 .I ifr_hwaddr
289 のアドレスを追加・削除する。これらの操作には特権が必要である。
290 別の方法が
291 .BR packet (7)
292 で解説されている。
293 .TP
294 .BR SIOCGIFTXQLEN ", " SIOCSIFTXQLEN
295 .\"O Get or set the transmit queue length of a device using
296 .\"O .IR ifr_qlen .
297 .\"O Setting the transmit queue length is a privileged operation.
298 デバイスの送信キューの長さを
299 .I ifr_qlen
300 に取得・設定する。送信キューの長さの設定には特権が必要である。
301 .TP
302 .B SIOCSIFNAME
303 .\"O Changes the name of the interface specified in
304 .\"O .I ifr_name
305 .\"O to
306 .\"O .IR ifr_newname .
307 .\"O This is a privileged operation.
308 .\"O It is only allowed when the interface
309 .\"O is not up.
310 .I ifr_name
311 で指定したインターフェースの名前を
312 .I ifr_newname
313 に変更する。この操作には特権が必要である。インターフェースが up していない
314 時にのみ使用できる。
315 .TP
316 .B SIOCGIFCONF
317 .\"O Return a list of interface (transport layer) addresses.
318 .\"O This currently
319 .\"O means only addresses of the
320 .\"O .B AF_INET
321 .\"O (IPv4) family for compatibility.
322 インターフェース(トランスポート層)アドレスのリストを返す。
323 現在のところ、互換性のために
324 .B AF_INET
325 (IPv4) ファミリーのアドレスのみである。
326 .\"O The user passes a
327 .\"O .I ifconf
328 .\"O structure as argument to the ioctl.
329 .\"O It contains a pointer to an array of
330 .\"O .I ifreq
331 .\"O structures in
332 .\"O .I ifc_req
333 .\"O and its length in bytes in
334 .\"O .IR ifc_len .
335 ユーザーは
336 .I ifconf
337 構造体を ioctl の引数として渡す。
338 .I ifconf
339 構造体には、
340 .I ifreq
341 構造体の配列へのポインタである
342 .I ifc_req
343 と、バイト単位の配列の長さを指定する
344 .I ifc_len
345 が含まれる。
346 .\"O The kernel fills the ifreqs with all current L3 interface addresses that
347 .\"O are running:
348 .\"O .I ifr_name
349 .\"O contains the interface name (eth0:1 etc.),
350 .\"O .I ifr_addr
351 .\"O the address.
352 カーネルは ifreqs を現在動作している全ての L3 インターフェースアドレスで埋める。
353 .I ifr_name
354 にはインターフェース名 (eth0:1 など) が入り、
355 .I ifr_addr
356 にはアドレスが入る。
357 .\"O The kernel returns with the actual length in
358 .\"O .IR ifc_len .
359 カーネルは実際の長さを
360 .I ifc_len
361 に返す。
362 .\"O If
363 .\"O .I ifc_len
364 .\"O is equal to the original length the buffer probably has overflowed
365 .\"O and you should retry with a bigger buffer to get all addresses.
366 .I ifc_len
367 が元のバッファの長さと同じだった場合、
368 オーバーフローを起こしている可能性があるので、
369 全てのアドレスを取得するためにより大きなバッファで再試行するべきである。
370 .\"O When no error occurs the ioctl returns 0;
371 .\"O otherwise \-1.
372 .\"O Overflow is no an error.
373 エラーがなかった場合は ioctl は 0 を返す。
374 エラーがあった場合は \-1 を返す。
375 オーバーフローはエラーとは見なされない。
376 .\" Slaving isn't supported in 2.2
377 .\" .
378 .\" .TP
379 .\" .BR SIOCGIFSLAVE ", " SIOCSIFSLAVE
380 .\" Get or set the slave device using
381 .\" .IR ifr_slave .
382 .\" Setting the slave device is a privileged operation.
383 .\" .PP
384 .\" FIXME add amateur radio stuff.
385 .PP
386 .\"O Most protocols support their own ioctls to configure protocol-specific
387 .\"O interface options.
388 .\"O See the protocol man pages for a description.
389 ほとんどのプロトコルには、専用のインターフェースオプションを
390 設定するための独自の ioctl が存在する。
391 説明は各プロトコルの man ページを見よ。
392 .PP
393 .\"O In addition some devices support private ioctls.
394 .\"O These are not described here.
395 さらに、デバイスによってはプライベートな ioctl がある。
396 これらはここでは説明しない。
397 .\"O .SH NOTES
398 .SH 注意
399 .\"O Strictly speaking,
400 .\"O .B SIOCGIFCONF
401 .\"O is IP specific and belongs in
402 .\"O .BR ip (7).
403 厳密にいうと、
404 .B SIOCGIFCONF
405 は IP 固有であり、
406 .BR ip (7)
407 に属する。
408 .LP
409 .\"O The names of interfaces with no addresses or that don't have the
410 .\"O .B IFF_RUNNING
411 .\"O flag set can be found via
412 .\"O .IR /proc/net/dev .
413 アドレスがなかったり、
414 .B IFF_RUNNING
415 フラグがセットされていないインターフェースの名前は
416 .I /proc/net/dev
417 で知ることができる。
418 .LP
419 .\"O Local IPv6 IP addresses can be found via
420 .\"O .I /proc/net
421 .\"O or via
422 .\"O .BR rtnetlink (7).
423 ローカル IPV6 IP アドレスは
424 .I /proc/net
425
426 .BR rtnetlink (7)
427 で知ることができる。
428 .\"O .SH BUGS
429 .SH バグ
430 .\"O glibc 2.1 is missing the
431 .\"O .I ifr_newname
432 .\"O macro in
433 .\"O .IR <net/if.h> .
434 .\"O Add the following to your program as a workaround:
435 glibc 2.1 では
436 .I <net/if.h>
437
438 .I ifr_newname
439 マクロがない。
440 とりあえずの対応策として、以下のコードを追加しておくこと。
441 .sp
442 .in +4n
443 .nf
444 #ifndef ifr_newname
445 #define ifr_newname     ifr_ifru.ifru_slave
446 #endif
447 .fi
448 .in
449 .RE
450 .\"O .SH SEE ALSO
451 .SH 関連項目
452 .BR proc (5),
453 .BR capabilities (7),
454 .BR ip (7),
455 .BR rtnetlink (7)