File: rtnetlink.7

package info (click to toggle)
manpages-ja 0.5.0.0.20100315-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 21,156 kB
  • ctags: 1
  • sloc: sh: 13,935; perl: 157; makefile: 114
file content (467 lines) | stat: -rw-r--r-- 11,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
'\" t
.\" Don't remove the line above, it tells man that tbl is needed.
.\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
.\" Permission is granted to distribute possibly modified copies
.\" of this page provided the header is included verbatim,
.\" and in case of nontrivial modification author and date
.\" of the modification is added to the header.
.\" Based on the original comments from Alexey Kuznetsov, written with
.\" help from Matthew Wilcox.
.\" $Id: rtnetlink.7,v 1.10 2001/04/04 08:02:19 ysato Exp $
.\"
.\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved.
.\" Translated Mon 6 Dec 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
.\"
.\"WORD         queueing dicipline      塼()롼
.\"WORD         permanent               ³Ū
.\"WORD         neighbor                ˵
.\"
.TH RTNETLINK  7 2008-08-08 "Linux" "Linux Programmer's Manual"
.SH ̾
rtnetlink, NETLINK_ROUTE \- Linux IPv4 롼ƥ󥰥å
.SH 
.B #include <asm/types.h>
.br
.B #include <linux/netlink.h>
.br
.B #include <linux/rtnetlink.h>
.br
.B #include <sys/socket.h>
.sp
.BI "rtnetlink_socket = socket(AF_NETLINK, int " socket_type ", NETLINK_ROUTE);"
.SH 
.B rtnetlink
ϥͥΥ롼ƥ󥰥ơ֥ɤѹ
뤿ΤΤǤ롣ϥͥ뤬Υ֥ƥ
̿뤿ˤѤƤ뤬ϤǤϵҤʤ
 man ڡǤϥ桼֤ΥץȤ̿˴ؤƤΤ߽Ҥ٤롣
ͥåȥϩIP ɥ쥹󥯥ѥ᡼
˵ (neighbor setup)塼󥰥롼 (queueing dicipline)
ȥեå饹ѥåȤΥ饹ʬʤɤ٤
.B NETLINK_ROUTE
åȤ̤Ǥ롣
.B rtnetlink
 netlink å١ˤƤ롣ܺ٤
.BR netlink (7)
򸫤뤳ȡ
.\" FIXME ? all these macros could be moved to rtnetlink(3)
.SS 롼ƥ°
rtnetlink åˤϡإåθղŪ°
ĤΤ롣

.in +4n
.nf
struct rtattr {
    unsigned short rta_len;    /* Length of option */
    unsigned short rta_type;   /* Type of option */
    /* Data follows */
};
.fi
.in

°ϡ RTA_* ޥ libnetlink ̤ƤΤ
Ԥ٤Ǥ롣
.BR rtnetlink (3)
򸫤衣
.SS å
rtnetlink  (ɸŪ netlink å˲ä)
ʲΥåפ鹽롣
.TP
.BR RTM_NEWLINK ", " RTM_DELLINK ", " RTM_GETLINK
ꤷͥåȥ󥿡եξ롣
Υå
.I ifinfomsg
¤Τȡ³ƤĤ
.I rtattr
¤Τȼ

.nf
struct ifinfomsg {
    unsigned char  ifi_family; /* AF_UNSPEC */
    unsigned short ifi_type;   /* Device type */
    int            ifi_index;  /* Interface index */
    unsigned int   ifi_flags;  /* Device flags  */
    unsigned int   ifi_change; /* change mask */
};
.fi

.\" FIXME ifi_type
.I ifi_flags
ϥǥХΥե饰Ǥ롣
.BR netdevice (7)
򸫤衣
.I ifi_index
¾ȽŤʤʤ󥿡ե index Ǥ롣
.I ifi_change
ϾѤΤͽ󤵤Ƥꡢ
0xFFFFFFFF ˥åȤ٤Ǥ롣
.TS
tab(:);
c
l l l.
롼ƥ°
rta_type:ͤη:
_
IFLA_UNSPEC:-:ꤵƤʤ
IFLA_ADDRESS:hardware address:T{
󥿡ե L2 ɥ쥹
T}
IFLA_BROADCAST:hardware address:T{
L2 ֥ɥ㥹ȥɥ쥹
T}
IFLA_IFNAME:asciiz string:ǥХ̾
IFLA_MTU:unsigned int:ǥХ MTU
IFLA_LINK:int:󥯥
IFLA_QDISC:asciiz string:塼󥰤Υ롼
IFLA_STATS:T{

T}:󥿡ե
.TE
.sp
IFLA_STATS ͤη \fIstruct net_device_stats\fP Ǥ롣
.TP
.BR RTM_NEWADDR ", " RTM_DELADDR ", " RTM_GETADDR
󥿡ե IP ɥ쥹ξɲá롣
Linux 2.2 ǤϡĤΥ󥿡եʣ IP ɥ쥹
ݻ뤳ȤǤ 2.0 ̾ǥХγǰ֤롣
Linux 2.2 ǤϡΥå
IPv4  IPv6 ξΥɥ쥹򥵥ݡȤƤ롣

.I ifaddrmsg
¤ΤȼΤȤ
.I rtaddr
롼ƥ°³Ȥ⤢롣

.nf
struct ifaddrmsg {
    unsigned char ifa_family;    /* Address type */
    unsigned char ifa_prefixlen; /* Prefixlength of address */
    unsigned char ifa_flags;     /* Address flags */
    unsigned char ifa_scope;     /* Address scope */
    int           ifa_index;     /* Interface index */
};
.fi

.I ifa_family
ϥɥ쥹եߥ꡼ΥפǤ (ߤ
.B AF_INET
ޤ
.BR AF_INET6 )
.I ifa_prefixlen
ϥɥ쥹Υɥ쥹ޥĹǤ (IPv4 Τ褦ˡ
Υեߥ꡼Ƥ)
.I ifa_scope
ϥɥ쥹ΥפǤ롣
.I ifa_index
ϥɥ쥹ϢŤƤ륤󥿡ե index Ǥ롣
.I ifa_flags
ϥե饰ɤǡ
ĤΥɥ쥹 (Ť̾󥿡ե) ξ
.B IFA_F_SECONDARY
ˡ³Ūʥɥ쥹ξ
.B IFA_F_PERMANENT
ŬѤ롣桼ˤäƥåȤե饰ȡ
undocumented ʥե饰롣
.TS
tab(:);
c
l l l.
°
rta_type:ͤη:
_
IFA_UNSPEC:-:ꤵƤʤ
IFA_ADDRESS:raw protocol address:󥿡եɥ쥹
IFA_LOCAL:raw protocol address:륢ɥ쥹
IFA_LABEL:asciiz string:󥿡ե̾
IFA_BROADCAST:raw protocol address:֥ɥ㥹ȥɥ쥹
IFA_ANYCAST:raw protocol address:anycast ɥ쥹
IFA_CACHEINFO:struct ifa_cacheinfo:ɥ쥹
.TE
.\" FIXME struct ifa_cacheinfo
.TP
.BR RTM_NEWROUTE ", " RTM_DELROUTE ", " RTM_GETROUTE
ͥåȥϩξ롣
Υå
.I rtmsg
¤ΤȼΤȤˤĤ
.I rtattr
¤Τ³뤳ȤǤ롣
.B RTM_GETROUTE

.I rtm_dst_len

.I rtm_src_len
 0 򥻥åȤȡ
ꤵ줿롼ƥ󥰥ơ֥ƤΥȥ롣
.I rtm_table

.I rtm_protocol
ʳ¾Υեɤ 0 ȡ磻ɥɤ̣롣

.nf
struct rtmsg {
    unsigned char rtm_family;   /* Address family of route */
    unsigned char rtm_dst_len;  /* Length of source */
    unsigned char rtm_src_len;  /* Length of destination */
    unsigned char rtm_tos;      /* TOS filter */

    unsigned char rtm_table;    /* Routing table ID */
    unsigned char rtm_protocol; /* Routing protocol; see below */
    unsigned char rtm_scope;    /* See below */
    unsigned char rtm_type;     /* See below */

    unsigned int  rtm_flags;
};
.fi
.TS
tab(:);
l l.
rtm_type:ϩΥ
_
RTN_UNSPEC:̤Τηϩ
RTN_UNICAST:ȥޤϥ쥯Ȥʷϩ
RTN_LOCAL:륤󥿡եηϩ
RTN_BROADCAST:T{
ʥ֥ɥ㥹ȷϩ
(֥ɥ㥹ȤȤ)
T}
RTN_ANYCAST:T{
ʥ֥ɥ㥹ȷϩ
(˥㥹ȤȤ)
T}
RTN_MULTICAST:ޥ㥹ȷϩ
RTN_BLACKHOLE:ѥåȤΤƤϩ
RTN_UNREACHABLE:ãǤʤԤ
RTN_PROHIBIT:ѥåȤݤϩ
RTN_THROW:ϩõ̤Υơ֥Ƿ³
RTN_NAT:ͥåȥɥ쥹Ѵ롼
RTN_XRESOLVE:T{
쥾Ф򻲾 (Ƥʤ)
T}
.TE
.TS
tab(:);
l l.
rtm_protocol:ϩξ
_
RTPROT_UNSPEC:
RTPROT_REDIRECT:T{
ICMP 쥯Ȥˤ (ߤѤʤ)
T}
RTPROT_KERNEL:ͥˤ
RTPROT_BOOT:֡Ȼ
RTPROT_STATIC:Ԥˤ
.TE

.B RTPROT_STATIC
礭ͤϥͥˤäƲᤵʤ
ñʤ桼ؤξǤ롣Ϸϩξ󸻤
դꡢʣΥ롼ƥ󥰥ǡ󤫤ξ
̤뤿Ѥ뤳ȤǤ롣
˳ƤƤ롼ƥ󥰥ǡμ̻ҤˤĤƤ
.I <linux/rtnetlink.h>
򸫤衣

.I rtm_scope
ϹԤؤεΥǤ롣

.TS
tab(:);
l l.
RT_SCOPE_UNIVERSE:Хʷϩ
RT_SCOPE_SITE:T{
ʼΧƥˤϩ
T}
RT_SCOPE_LINK:Υ󥯾ηϩ
RT_SCOPE_HOST:ۥȾηϩ
RT_SCOPE_NOWHERE:Ԥ褬¸ߤʤ
.TE

.B RT_SCOPE_UNIVERSE

.B RT_SCOPE_SITE
δ֤ͤѤ뤳ȤǤ롣

.I rtm_flags
ϰʲΰ̣:
.TS
tab(:);
l l.
RTM_F_NOTIFY:T{
ϩѹȡ rtnetlink ̤ƥ桼ΤԤ
T}
RTM_F_CLONED:ϩ¾ηϩˤäʣ줿
RTM_F_EQUALIZE:ޥѥ饤 (ޤƤʤ)
.TE

.I rtm_table
Ǥϥ롼ƥ󥰥ơ֥ꤹ롣
.TS
tab(:);
l l.
RT_TABLE_UNSPEC:ꤵƤʤ롼ƥ󥰥ơ֥
RT_TABLE_DEFAULT:ǥեȤΥơ֥
RT_TABLE_MAIN:ᥤΥơ֥
RT_TABLE_LOCAL:ơ֥
.TE

.B RT_TABLE_UNSPEC

.BR RT_TABLE_DEFAULT .
δ֤ǤդͤѤ뤳ȤǤ롣
.TS
tab(:);
c
l l l.
°
rta_type:ͤη:
_
RTA_UNSPEC:-:̵뤵
RTA_DST:protocol address:ϩιԤ襢ɥ쥹
RTA_SRC:protocol address:ϩȯɥ쥹
RTA_IIF:int:ϥ󥿡ե index
RTA_OIF:int:ϥ󥿡ե index
RTA_GATEWAY:protocol address:ϩΥȥ
RTA_PRIORITY:int:ϩͥ
RTA_PREFSRC::
RTA_METRICS:int:ϩΥȥå
RTA_MULTIPATH::
RTA_PROTOINFO::
RTA_FLOW::
RTA_CACHEINFO::
.TE

.B (ͤ뤳!)
.TP
.BR RTM_NEWNEIGH ", " RTM_DELNEIGH  ", " RTM_GETNEIGH
˵ơ֥ (neighbor table) Υȥ
(㤨 ARP ȥ) ξɲá롣
Υå
.I ndmsg
¤Τȼ

.nf
struct ndmsg {
    unsigned char ndm_family;
    int           ndm_ifindex;  /* Interface index */
    __u16         ndm_state;    /* State */
    __u8          ndm_flags;    /* Flags */
    __u8          ndm_type;
};

struct nda_cacheinfo {
    __u32         ndm_confirmed;
    __u32         ndm_used;
    __u32         ndm_updated;
    __u32         ndm_refcnt;
};
.fi

.I ndm_state
ϰʲξ֤ΥӥåȥޥǤ:
.TS
tab(:);
l l.
NUD_INCOMPLETE:ߥ쥾Υå奨ȥ
NUD_REACHABLE:ưǧѤߤΥå奨ȥ
NUD_STALE:ڤΥå奨ȥ
NUD_DELAY:ԤΥå奨ȥ
NUD_PROBE:ƳǧΥå奨ȥ
NUD_FAILED:ʥå奨ȥ
NUD_NOARP:Ԥ襭åΤʤǥХ
NUD_PERMANENT:Ūʥȥ
.TE

ͭ
.I ndm_flags
ϰʲ̤:
.TS
tab(:);
l l.
NTF_PROXY:ץ arp ȥ
NTF_ROUTER:IPv6 롼
.TE

.\" FIXME
.\" document the members of the struct better
.I rtaddr
¤Τϡ
.I rta_type
եɤ˱Ƥ줾ʲΰ̣:
.TS
tab(:);
l l.
NDA_UNSPEC:̤ΤΥ
NDA_DST:˵åͥåȥؤιԤ襢ɥ쥹
NDA_LLADDR:˵åؤΥɥ쥹
NDA_CACHEINFO:å
.TE

.I rta_type
եɤ
.B NDA_CACHEINFO
ξˤϡ
.I struct nda_cacheinfo
إå³
.TP
.BR RTM_NEWRULE ", " RTM_DELRULE ", " RTM_GETRULE
롼ƥ󥰥롼ɲá롣
.I struct rtmsg
ȼ
.TP
.BR RTM_NEWQDISC ", " RTM_DELQDISC ", " RTM_GETQDISC
塼󥰥롼ɲá롣
Υå
.I struct tcmsg
ȼޤΤȤ°Ĥ³Ȥ⤢롣

.nf
struct tcmsg {
    unsigned char    tcm_family;
    int              tcm_ifindex;   /* interface index */
    __u32            tcm_handle;    /* Qdisc handle */
    __u32            tcm_parent;    /* Parent qdisc */
    __u32            tcm_info;
};
.fi
.TS
tab(:);
c
l l l.
°
rta_type:ͤη:
_
TCA_UNSPEC:-:ꤵƤʤ
TCA_KIND:asciiz string:塼󥰥롼̾
TCA_OPTIONS:byte sequence:Qdisc ͭΥץ³
TCA_STATS:struct tc_stats:Qdisc 
TCA_XSTATS:qdisc specific:⥸塼ͭ
TCA_RATE:struct tc_estimator:졼
.TE

ˡ qdisc ⥸塼ͭ͡°Ǥ롣
ܺ٤ʾŬڤʥ󥯥롼ɥե򸫤衣
.TP
.BR RTM_NEWTCLASS ", " RTM_DELTCLASS ", " RTM_GETTCLASS
ȥեå饹ɲá롣
ΥåϡҤ
.I struct tcmsg
ȼ
.TP
.BR RTM_NEWTFILTER ", " RTM_DELTFILTER ", " RTM_GETTFILTER
ȥեåե륿ξɲá롣
ΥåϡҤ
.I struct tcmsg
ȼ
.SH С
.B rtnetlink
 Linux 2.2 οǽǤ롣
.SH Х
 man ڡԴǤ롣
.SH Ϣ
.BR cmsg (3),
.BR rtnetlink (3),
.BR ip (7),
.BR netlink (7)