]>
Commit | Line | Data |
---|---|---|
0633baa1 SH |
1 | #ifndef __LINUX_RTNETLINK_H |
2 | #define __LINUX_RTNETLINK_H | |
3 | ||
4 | #include <linux/netlink.h> | |
5 | ||
6 | /**** | |
7 | * Routing/neighbour discovery messages. | |
8 | ****/ | |
9 | ||
10 | /* Types of messages */ | |
11 | ||
091ed219 SH |
12 | enum { |
13 | RTM_BASE = 16, | |
14 | #define RTM_BASE RTM_BASE | |
15 | ||
16 | RTM_NEWLINK = 16, | |
17 | #define RTM_NEWLINK RTM_NEWLINK | |
18 | RTM_DELLINK, | |
19 | #define RTM_DELLINK RTM_DELLINK | |
20 | RTM_GETLINK, | |
21 | #define RTM_GETLINK RTM_GETLINK | |
22 | RTM_SETLINK, | |
23 | #define RTM_SETLINK RTM_SETLINK | |
24 | ||
25 | RTM_NEWADDR = 20, | |
26 | #define RTM_NEWADDR RTM_NEWADDR | |
27 | RTM_DELADDR, | |
28 | #define RTM_DELADDR RTM_DELADDR | |
29 | RTM_GETADDR, | |
30 | #define RTM_GETADDR RTM_GETADDR | |
31 | ||
32 | RTM_NEWROUTE = 24, | |
33 | #define RTM_NEWROUTE RTM_NEWROUTE | |
34 | RTM_DELROUTE, | |
35 | #define RTM_DELROUTE RTM_DELROUTE | |
36 | RTM_GETROUTE, | |
37 | #define RTM_GETROUTE RTM_GETROUTE | |
38 | ||
39 | RTM_NEWNEIGH = 28, | |
40 | #define RTM_NEWNEIGH RTM_NEWNEIGH | |
41 | RTM_DELNEIGH, | |
42 | #define RTM_DELNEIGH RTM_DELNEIGH | |
43 | RTM_GETNEIGH, | |
44 | #define RTM_GETNEIGH RTM_GETNEIGH | |
45 | ||
46 | RTM_NEWRULE = 32, | |
47 | #define RTM_NEWRULE RTM_NEWRULE | |
48 | RTM_DELRULE, | |
49 | #define RTM_DELRULE RTM_DELRULE | |
50 | RTM_GETRULE, | |
51 | #define RTM_GETRULE RTM_GETRULE | |
52 | ||
53 | RTM_NEWQDISC = 36, | |
54 | #define RTM_NEWQDISC RTM_NEWQDISC | |
55 | RTM_DELQDISC, | |
56 | #define RTM_DELQDISC RTM_DELQDISC | |
57 | RTM_GETQDISC, | |
58 | #define RTM_GETQDISC RTM_GETQDISC | |
59 | ||
60 | RTM_NEWTCLASS = 40, | |
61 | #define RTM_NEWTCLASS RTM_NEWTCLASS | |
62 | RTM_DELTCLASS, | |
63 | #define RTM_DELTCLASS RTM_DELTCLASS | |
64 | RTM_GETTCLASS, | |
65 | #define RTM_GETTCLASS RTM_GETTCLASS | |
66 | ||
67 | RTM_NEWTFILTER = 44, | |
68 | #define RTM_NEWTFILTER RTM_NEWTFILTER | |
69 | RTM_DELTFILTER, | |
70 | #define RTM_DELTFILTER RTM_DELTFILTER | |
71 | RTM_GETTFILTER, | |
72 | #define RTM_GETTFILTER RTM_GETTFILTER | |
73 | ||
74 | RTM_NEWACTION = 48, | |
75 | #define RTM_NEWACTION RTM_NEWACTION | |
76 | RTM_DELACTION, | |
77 | #define RTM_DELACTION RTM_DELACTION | |
78 | RTM_GETACTION, | |
79 | #define RTM_GETACTION RTM_GETACTION | |
80 | ||
81 | RTM_NEWPREFIX = 52, | |
82 | #define RTM_NEWPREFIX RTM_NEWPREFIX | |
83 | RTM_GETPREFIX = 54, | |
84 | #define RTM_GETPREFIX RTM_GETPREFIX | |
85 | ||
86 | RTM_GETMULTICAST = 58, | |
87 | #define RTM_GETMULTICAST RTM_GETMULTICAST | |
88 | ||
89 | RTM_GETANYCAST = 62, | |
90 | #define RTM_GETANYCAST RTM_GETANYCAST | |
91 | ||
92 | RTM_MAX, | |
93 | #define RTM_MAX RTM_MAX | |
94 | }; | |
0633baa1 SH |
95 | |
96 | /* | |
97 | Generic structure for encapsulation of optional route information. | |
98 | It is reminiscent of sockaddr, but with sa_family replaced | |
99 | with attribute type. | |
100 | */ | |
101 | ||
102 | struct rtattr | |
103 | { | |
104 | unsigned short rta_len; | |
105 | unsigned short rta_type; | |
106 | }; | |
107 | ||
108 | /* Macros to handle rtattributes */ | |
109 | ||
110 | #define RTA_ALIGNTO 4 | |
111 | #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) | |
112 | #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ | |
113 | (rta)->rta_len >= sizeof(struct rtattr) && \ | |
114 | (rta)->rta_len <= (len)) | |
115 | #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ | |
116 | (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) | |
117 | #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) | |
118 | #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) | |
119 | #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) | |
120 | #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) | |
121 | ||
122 | ||
123 | ||
124 | ||
125 | /****************************************************************************** | |
126 | * Definitions used in routing table administration. | |
127 | ****/ | |
128 | ||
129 | struct rtmsg | |
130 | { | |
131 | unsigned char rtm_family; | |
132 | unsigned char rtm_dst_len; | |
133 | unsigned char rtm_src_len; | |
134 | unsigned char rtm_tos; | |
135 | ||
136 | unsigned char rtm_table; /* Routing table id */ | |
137 | unsigned char rtm_protocol; /* Routing protocol; see below */ | |
138 | unsigned char rtm_scope; /* See below */ | |
139 | unsigned char rtm_type; /* See below */ | |
140 | ||
141 | unsigned rtm_flags; | |
142 | }; | |
143 | ||
144 | /* rtm_type */ | |
145 | ||
146 | enum | |
147 | { | |
148 | RTN_UNSPEC, | |
149 | RTN_UNICAST, /* Gateway or direct route */ | |
150 | RTN_LOCAL, /* Accept locally */ | |
151 | RTN_BROADCAST, /* Accept locally as broadcast, | |
152 | send as broadcast */ | |
153 | RTN_ANYCAST, /* Accept locally as broadcast, | |
154 | but send as unicast */ | |
155 | RTN_MULTICAST, /* Multicast route */ | |
156 | RTN_BLACKHOLE, /* Drop */ | |
157 | RTN_UNREACHABLE, /* Destination is unreachable */ | |
158 | RTN_PROHIBIT, /* Administratively prohibited */ | |
159 | RTN_THROW, /* Not in this table */ | |
160 | RTN_NAT, /* Translate this address */ | |
161 | RTN_XRESOLVE, /* Use external resolver */ | |
162 | __RTN_MAX | |
163 | }; | |
164 | ||
165 | #define RTN_MAX (__RTN_MAX - 1) | |
166 | ||
167 | ||
168 | /* rtm_protocol */ | |
169 | ||
170 | #define RTPROT_UNSPEC 0 | |
171 | #define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; | |
172 | not used by current IPv4 */ | |
173 | #define RTPROT_KERNEL 2 /* Route installed by kernel */ | |
174 | #define RTPROT_BOOT 3 /* Route installed during boot */ | |
175 | #define RTPROT_STATIC 4 /* Route installed by administrator */ | |
176 | ||
177 | /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; | |
178 | they are just passed from user and back as is. | |
179 | It will be used by hypothetical multiple routing daemons. | |
180 | Note that protocol values should be standardized in order to | |
181 | avoid conflicts. | |
182 | */ | |
183 | ||
184 | #define RTPROT_GATED 8 /* Apparently, GateD */ | |
185 | #define RTPROT_RA 9 /* RDISC/ND router advertisements */ | |
186 | #define RTPROT_MRT 10 /* Merit MRT */ | |
187 | #define RTPROT_ZEBRA 11 /* Zebra */ | |
188 | #define RTPROT_BIRD 12 /* BIRD */ | |
189 | #define RTPROT_DNROUTED 13 /* DECnet routing daemon */ | |
190 | #define RTPROT_XORP 14 /* XORP */ | |
191 | ||
192 | /* rtm_scope | |
193 | ||
194 | Really it is not scope, but sort of distance to the destination. | |
195 | NOWHERE are reserved for not existing destinations, HOST is our | |
196 | local addresses, LINK are destinations, located on directly attached | |
197 | link and UNIVERSE is everywhere in the Universe. | |
198 | ||
199 | Intermediate values are also possible f.e. interior routes | |
200 | could be assigned a value between UNIVERSE and LINK. | |
201 | */ | |
202 | ||
203 | enum rt_scope_t | |
204 | { | |
205 | RT_SCOPE_UNIVERSE=0, | |
206 | /* User defined values */ | |
207 | RT_SCOPE_SITE=200, | |
208 | RT_SCOPE_LINK=253, | |
209 | RT_SCOPE_HOST=254, | |
210 | RT_SCOPE_NOWHERE=255 | |
211 | }; | |
212 | ||
213 | /* rtm_flags */ | |
214 | ||
215 | #define RTM_F_NOTIFY 0x100 /* Notify user of route change */ | |
216 | #define RTM_F_CLONED 0x200 /* This route is cloned */ | |
217 | #define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ | |
218 | #define RTM_F_PREFIX 0x800 /* Prefix addresses */ | |
219 | ||
220 | /* Reserved table identifiers */ | |
221 | ||
222 | enum rt_class_t | |
223 | { | |
224 | RT_TABLE_UNSPEC=0, | |
225 | /* User defined values */ | |
226 | RT_TABLE_DEFAULT=253, | |
227 | RT_TABLE_MAIN=254, | |
228 | RT_TABLE_LOCAL=255, | |
229 | __RT_TABLE_MAX | |
230 | }; | |
231 | #define RT_TABLE_MAX (__RT_TABLE_MAX - 1) | |
232 | ||
233 | ||
234 | ||
235 | /* Routing message attributes */ | |
236 | ||
237 | enum rtattr_type_t | |
238 | { | |
239 | RTA_UNSPEC, | |
240 | RTA_DST, | |
241 | RTA_SRC, | |
242 | RTA_IIF, | |
243 | RTA_OIF, | |
244 | RTA_GATEWAY, | |
245 | RTA_PRIORITY, | |
246 | RTA_PREFSRC, | |
247 | RTA_METRICS, | |
248 | RTA_MULTIPATH, | |
249 | RTA_PROTOINFO, | |
250 | RTA_FLOW, | |
251 | RTA_CACHEINFO, | |
252 | RTA_SESSION, | |
206a0441 | 253 | RTA_MP_ALGO, |
0633baa1 SH |
254 | __RTA_MAX |
255 | }; | |
256 | ||
257 | #define RTA_MAX (__RTA_MAX - 1) | |
258 | ||
259 | #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) | |
260 | #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) | |
261 | ||
262 | /* RTM_MULTIPATH --- array of struct rtnexthop. | |
263 | * | |
264 | * "struct rtnexthop" describes all necessary nexthop information, | |
265 | * i.e. parameters of path to a destination via this nexthop. | |
266 | * | |
267 | * At the moment it is impossible to set different prefsrc, mtu, window | |
268 | * and rtt for different paths from multipath. | |
269 | */ | |
270 | ||
271 | struct rtnexthop | |
272 | { | |
273 | unsigned short rtnh_len; | |
274 | unsigned char rtnh_flags; | |
275 | unsigned char rtnh_hops; | |
276 | int rtnh_ifindex; | |
277 | }; | |
278 | ||
279 | /* rtnh_flags */ | |
280 | ||
281 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ | |
282 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ | |
283 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ | |
284 | ||
285 | /* Macros to handle hexthops */ | |
286 | ||
287 | #define RTNH_ALIGNTO 4 | |
288 | #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) | |
289 | #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ | |
290 | ((int)(rtnh)->rtnh_len) <= (len)) | |
291 | #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) | |
292 | #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) | |
293 | #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) | |
294 | #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) | |
295 | ||
296 | /* RTM_CACHEINFO */ | |
297 | ||
298 | struct rta_cacheinfo | |
299 | { | |
300 | __u32 rta_clntref; | |
301 | __u32 rta_lastuse; | |
302 | __s32 rta_expires; | |
303 | __u32 rta_error; | |
304 | __u32 rta_used; | |
305 | ||
306 | #define RTNETLINK_HAVE_PEERINFO 1 | |
307 | __u32 rta_id; | |
308 | __u32 rta_ts; | |
309 | __u32 rta_tsage; | |
310 | }; | |
311 | ||
312 | /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ | |
313 | ||
314 | enum | |
315 | { | |
316 | RTAX_UNSPEC, | |
317 | #define RTAX_UNSPEC RTAX_UNSPEC | |
318 | RTAX_LOCK, | |
319 | #define RTAX_LOCK RTAX_LOCK | |
320 | RTAX_MTU, | |
321 | #define RTAX_MTU RTAX_MTU | |
322 | RTAX_WINDOW, | |
323 | #define RTAX_WINDOW RTAX_WINDOW | |
324 | RTAX_RTT, | |
325 | #define RTAX_RTT RTAX_RTT | |
326 | RTAX_RTTVAR, | |
327 | #define RTAX_RTTVAR RTAX_RTTVAR | |
328 | RTAX_SSTHRESH, | |
329 | #define RTAX_SSTHRESH RTAX_SSTHRESH | |
330 | RTAX_CWND, | |
331 | #define RTAX_CWND RTAX_CWND | |
332 | RTAX_ADVMSS, | |
333 | #define RTAX_ADVMSS RTAX_ADVMSS | |
334 | RTAX_REORDERING, | |
335 | #define RTAX_REORDERING RTAX_REORDERING | |
336 | RTAX_HOPLIMIT, | |
337 | #define RTAX_HOPLIMIT RTAX_HOPLIMIT | |
338 | RTAX_INITCWND, | |
339 | #define RTAX_INITCWND RTAX_INITCWND | |
340 | RTAX_FEATURES, | |
341 | #define RTAX_FEATURES RTAX_FEATURES | |
342 | __RTAX_MAX | |
343 | }; | |
344 | ||
345 | #define RTAX_MAX (__RTAX_MAX - 1) | |
346 | ||
347 | #define RTAX_FEATURE_ECN 0x00000001 | |
348 | #define RTAX_FEATURE_SACK 0x00000002 | |
349 | #define RTAX_FEATURE_TIMESTAMP 0x00000004 | |
206a0441 | 350 | #define RTAX_FEATURE_ALLFRAG 0x00000008 |
0633baa1 SH |
351 | |
352 | struct rta_session | |
353 | { | |
354 | __u8 proto; | |
355 | ||
356 | union { | |
357 | struct { | |
358 | __u16 sport; | |
359 | __u16 dport; | |
360 | } ports; | |
361 | ||
362 | struct { | |
363 | __u8 type; | |
364 | __u8 code; | |
365 | __u16 ident; | |
366 | } icmpt; | |
367 | ||
368 | __u32 spi; | |
369 | } u; | |
370 | }; | |
371 | ||
372 | ||
373 | /********************************************************* | |
374 | * Interface address. | |
375 | ****/ | |
376 | ||
377 | struct ifaddrmsg | |
378 | { | |
379 | unsigned char ifa_family; | |
380 | unsigned char ifa_prefixlen; /* The prefix length */ | |
381 | unsigned char ifa_flags; /* Flags */ | |
382 | unsigned char ifa_scope; /* See above */ | |
383 | int ifa_index; /* Link index */ | |
384 | }; | |
385 | ||
386 | enum | |
387 | { | |
388 | IFA_UNSPEC, | |
389 | IFA_ADDRESS, | |
390 | IFA_LOCAL, | |
391 | IFA_LABEL, | |
392 | IFA_BROADCAST, | |
393 | IFA_ANYCAST, | |
394 | IFA_CACHEINFO, | |
395 | IFA_MULTICAST, | |
396 | __IFA_MAX | |
397 | }; | |
398 | ||
399 | #define IFA_MAX (__IFA_MAX - 1) | |
400 | ||
206a0441 SH |
401 | /* |
402 | * Quirk for IPv4 address deletion to allow exact deletion of equal | |
403 | * addresses varying only in prefix length. A explicit exact comparison | |
404 | * of the prefix length will only be done if IFA_PREFIX_EXACT_DEL is | |
405 | * ORed to ifa_prefixlen. | |
406 | * | |
407 | * Note: This special treatment is only understood while deleting | |
408 | * addresses and will lead to unexpected behaviour if used | |
409 | * otherwise. | |
410 | */ | |
411 | #define IFA_PREFIX_EXACT_DEL 0x40 | |
412 | #define IFA_REAL_DEL_PREFIX(l) ((l) & 0x3f) | |
413 | ||
0633baa1 SH |
414 | /* ifa_flags */ |
415 | ||
416 | #define IFA_F_SECONDARY 0x01 | |
417 | #define IFA_F_TEMPORARY IFA_F_SECONDARY | |
418 | ||
419 | #define IFA_F_DEPRECATED 0x20 | |
420 | #define IFA_F_TENTATIVE 0x40 | |
421 | #define IFA_F_PERMANENT 0x80 | |
422 | ||
423 | struct ifa_cacheinfo | |
424 | { | |
425 | __u32 ifa_prefered; | |
426 | __u32 ifa_valid; | |
427 | __u32 cstamp; /* created timestamp, hundredths of seconds */ | |
428 | __u32 tstamp; /* updated timestamp, hundredths of seconds */ | |
429 | }; | |
430 | ||
431 | ||
432 | #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) | |
433 | #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) | |
434 | ||
435 | /* | |
436 | Important comment: | |
437 | IFA_ADDRESS is prefix address, rather than local interface address. | |
438 | It makes no difference for normally configured broadcast interfaces, | |
439 | but for point-to-point IFA_ADDRESS is DESTINATION address, | |
440 | local address is supplied in IFA_LOCAL attribute. | |
441 | */ | |
442 | ||
443 | /************************************************************** | |
444 | * Neighbour discovery. | |
445 | ****/ | |
446 | ||
447 | struct ndmsg | |
448 | { | |
449 | unsigned char ndm_family; | |
450 | unsigned char ndm_pad1; | |
451 | unsigned short ndm_pad2; | |
452 | int ndm_ifindex; /* Link index */ | |
453 | __u16 ndm_state; | |
454 | __u8 ndm_flags; | |
455 | __u8 ndm_type; | |
456 | }; | |
457 | ||
458 | enum | |
459 | { | |
460 | NDA_UNSPEC, | |
461 | NDA_DST, | |
462 | NDA_LLADDR, | |
463 | NDA_CACHEINFO, | |
206a0441 | 464 | NDA_PROBES, |
0633baa1 SH |
465 | __NDA_MAX |
466 | }; | |
467 | ||
468 | #define NDA_MAX (__NDA_MAX - 1) | |
469 | ||
470 | #define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg)))) | |
471 | #define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg)) | |
472 | ||
473 | /* | |
474 | * Neighbor Cache Entry Flags | |
475 | */ | |
476 | ||
477 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | |
478 | #define NTF_ROUTER 0x80 | |
479 | ||
480 | /* | |
481 | * Neighbor Cache Entry States. | |
482 | */ | |
483 | ||
484 | #define NUD_INCOMPLETE 0x01 | |
485 | #define NUD_REACHABLE 0x02 | |
486 | #define NUD_STALE 0x04 | |
487 | #define NUD_DELAY 0x08 | |
488 | #define NUD_PROBE 0x10 | |
489 | #define NUD_FAILED 0x20 | |
490 | ||
491 | /* Dummy states */ | |
492 | #define NUD_NOARP 0x40 | |
493 | #define NUD_PERMANENT 0x80 | |
494 | #define NUD_NONE 0x00 | |
495 | ||
496 | ||
497 | struct nda_cacheinfo | |
498 | { | |
499 | __u32 ndm_confirmed; | |
500 | __u32 ndm_used; | |
501 | __u32 ndm_updated; | |
502 | __u32 ndm_refcnt; | |
503 | }; | |
504 | ||
505 | /**** | |
506 | * General form of address family dependent message. | |
507 | ****/ | |
508 | ||
509 | struct rtgenmsg | |
510 | { | |
511 | unsigned char rtgen_family; | |
512 | }; | |
513 | ||
514 | /***************************************************************** | |
515 | * Link layer specific messages. | |
516 | ****/ | |
517 | ||
518 | /* struct ifinfomsg | |
519 | * passes link level specific information, not dependent | |
520 | * on network protocol. | |
521 | */ | |
522 | ||
523 | struct ifinfomsg | |
524 | { | |
525 | unsigned char ifi_family; | |
526 | unsigned char __ifi_pad; | |
527 | unsigned short ifi_type; /* ARPHRD_* */ | |
528 | int ifi_index; /* Link index */ | |
529 | unsigned ifi_flags; /* IFF_* flags */ | |
530 | unsigned ifi_change; /* IFF_* change mask */ | |
531 | }; | |
532 | ||
533 | /******************************************************************** | |
534 | * prefix information | |
535 | ****/ | |
536 | ||
537 | struct prefixmsg | |
538 | { | |
539 | unsigned char prefix_family; | |
540 | int prefix_ifindex; | |
541 | unsigned char prefix_type; | |
542 | unsigned char prefix_len; | |
543 | unsigned char prefix_flags; | |
544 | }; | |
545 | ||
546 | enum | |
547 | { | |
548 | PREFIX_UNSPEC, | |
549 | PREFIX_ADDRESS, | |
550 | PREFIX_CACHEINFO, | |
551 | __PREFIX_MAX | |
552 | }; | |
553 | ||
554 | #define PREFIX_MAX (__PREFIX_MAX - 1) | |
555 | ||
556 | struct prefix_cacheinfo | |
557 | { | |
558 | __u32 preferred_time; | |
559 | __u32 valid_time; | |
560 | }; | |
561 | ||
562 | /* The struct should be in sync with struct net_device_stats */ | |
563 | struct rtnl_link_stats | |
564 | { | |
565 | __u32 rx_packets; /* total packets received */ | |
566 | __u32 tx_packets; /* total packets transmitted */ | |
567 | __u32 rx_bytes; /* total bytes received */ | |
568 | __u32 tx_bytes; /* total bytes transmitted */ | |
569 | __u32 rx_errors; /* bad packets received */ | |
570 | __u32 tx_errors; /* packet transmit problems */ | |
571 | __u32 rx_dropped; /* no space in linux buffers */ | |
572 | __u32 tx_dropped; /* no space available in linux */ | |
573 | __u32 multicast; /* multicast packets received */ | |
574 | __u32 collisions; | |
575 | ||
576 | /* detailed rx_errors: */ | |
577 | __u32 rx_length_errors; | |
578 | __u32 rx_over_errors; /* receiver ring buff overflow */ | |
579 | __u32 rx_crc_errors; /* recved pkt with crc error */ | |
580 | __u32 rx_frame_errors; /* recv'd frame alignment error */ | |
581 | __u32 rx_fifo_errors; /* recv'r fifo overrun */ | |
582 | __u32 rx_missed_errors; /* receiver missed packet */ | |
583 | ||
584 | /* detailed tx_errors */ | |
585 | __u32 tx_aborted_errors; | |
586 | __u32 tx_carrier_errors; | |
587 | __u32 tx_fifo_errors; | |
588 | __u32 tx_heartbeat_errors; | |
589 | __u32 tx_window_errors; | |
590 | ||
591 | /* for cslip etc */ | |
592 | __u32 rx_compressed; | |
593 | __u32 tx_compressed; | |
594 | }; | |
595 | ||
091ed219 SH |
596 | /* The struct should be in sync with struct ifmap */ |
597 | struct rtnl_link_ifmap | |
598 | { | |
599 | __u64 mem_start; | |
600 | __u64 mem_end; | |
601 | __u64 base_addr; | |
602 | __u16 irq; | |
603 | __u8 dma; | |
604 | __u8 port; | |
605 | }; | |
606 | ||
0633baa1 SH |
607 | enum |
608 | { | |
609 | IFLA_UNSPEC, | |
610 | IFLA_ADDRESS, | |
611 | IFLA_BROADCAST, | |
612 | IFLA_IFNAME, | |
613 | IFLA_MTU, | |
614 | IFLA_LINK, | |
615 | IFLA_QDISC, | |
616 | IFLA_STATS, | |
617 | IFLA_COST, | |
618 | #define IFLA_COST IFLA_COST | |
619 | IFLA_PRIORITY, | |
620 | #define IFLA_PRIORITY IFLA_PRIORITY | |
621 | IFLA_MASTER, | |
622 | #define IFLA_MASTER IFLA_MASTER | |
623 | IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | |
624 | #define IFLA_WIRELESS IFLA_WIRELESS | |
625 | IFLA_PROTINFO, /* Protocol specific information for a link */ | |
626 | #define IFLA_PROTINFO IFLA_PROTINFO | |
091ed219 SH |
627 | IFLA_TXQLEN, |
628 | #define IFLA_TXQLEN IFLA_TXQLEN | |
629 | IFLA_MAP, | |
630 | #define IFLA_MAP IFLA_MAP | |
631 | IFLA_WEIGHT, | |
632 | #define IFLA_WEIGHT IFLA_WEIGHT | |
0633baa1 SH |
633 | __IFLA_MAX |
634 | }; | |
635 | ||
636 | ||
637 | #define IFLA_MAX (__IFLA_MAX - 1) | |
638 | ||
639 | #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) | |
640 | #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) | |
641 | ||
642 | /* ifi_flags. | |
643 | ||
644 | IFF_* flags. | |
645 | ||
646 | The only change is: | |
647 | IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are | |
648 | more not changeable by user. They describe link media | |
649 | characteristics and set by device driver. | |
650 | ||
651 | Comments: | |
652 | - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid | |
653 | - If neither of these three flags are set; | |
654 | the interface is NBMA. | |
655 | ||
656 | - IFF_MULTICAST does not mean anything special: | |
657 | multicasts can be used on all not-NBMA links. | |
658 | IFF_MULTICAST means that this media uses special encapsulation | |
659 | for multicast frames. Apparently, all IFF_POINTOPOINT and | |
660 | IFF_BROADCAST devices are able to use multicasts too. | |
661 | */ | |
662 | ||
663 | /* IFLA_LINK. | |
664 | For usual devices it is equal ifi_index. | |
665 | If it is a "virtual interface" (f.e. tunnel), ifi_link | |
666 | can point to real physical interface (f.e. for bandwidth calculations), | |
667 | or maybe 0, what means, that real media is unknown (usual | |
668 | for IPIP tunnels, when route to endpoint is allowed to change) | |
669 | */ | |
670 | ||
671 | /* Subtype attributes for IFLA_PROTINFO */ | |
672 | enum | |
673 | { | |
674 | IFLA_INET6_UNSPEC, | |
675 | IFLA_INET6_FLAGS, /* link flags */ | |
676 | IFLA_INET6_CONF, /* sysctl parameters */ | |
677 | IFLA_INET6_STATS, /* statistics */ | |
678 | IFLA_INET6_MCAST, /* MC things. What of them? */ | |
679 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | |
680 | __IFLA_INET6_MAX | |
681 | }; | |
682 | ||
683 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | |
684 | ||
685 | struct ifla_cacheinfo | |
686 | { | |
687 | __u32 max_reasm_len; | |
688 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | |
689 | __u32 reachable_time; | |
690 | __u32 retrans_time; | |
691 | }; | |
692 | ||
693 | /***************************************************************** | |
694 | * Traffic control messages. | |
695 | ****/ | |
696 | ||
697 | struct tcmsg | |
698 | { | |
699 | unsigned char tcm_family; | |
700 | unsigned char tcm__pad1; | |
701 | unsigned short tcm__pad2; | |
702 | int tcm_ifindex; | |
703 | __u32 tcm_handle; | |
704 | __u32 tcm_parent; | |
705 | __u32 tcm_info; | |
706 | }; | |
707 | ||
708 | enum | |
709 | { | |
710 | TCA_UNSPEC, | |
711 | TCA_KIND, | |
712 | TCA_OPTIONS, | |
713 | TCA_STATS, | |
714 | TCA_XSTATS, | |
715 | TCA_RATE, | |
716 | TCA_FCNT, | |
e5879dc6 | 717 | TCA_STATS2, |
0633baa1 SH |
718 | __TCA_MAX |
719 | }; | |
720 | ||
721 | #define TCA_MAX (__TCA_MAX - 1) | |
722 | ||
723 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) | |
724 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) | |
725 | ||
726 | ||
0633baa1 SH |
727 | /* RTnetlink multicast groups */ |
728 | ||
729 | #define RTMGRP_LINK 1 | |
730 | #define RTMGRP_NOTIFY 2 | |
731 | #define RTMGRP_NEIGH 4 | |
732 | #define RTMGRP_TC 8 | |
733 | ||
734 | #define RTMGRP_IPV4_IFADDR 0x10 | |
735 | #define RTMGRP_IPV4_MROUTE 0x20 | |
736 | #define RTMGRP_IPV4_ROUTE 0x40 | |
737 | ||
738 | #define RTMGRP_IPV6_IFADDR 0x100 | |
739 | #define RTMGRP_IPV6_MROUTE 0x200 | |
740 | #define RTMGRP_IPV6_ROUTE 0x400 | |
741 | #define RTMGRP_IPV6_IFINFO 0x800 | |
742 | ||
743 | #define RTMGRP_DECnet_IFADDR 0x1000 | |
744 | #define RTMGRP_DECnet_ROUTE 0x4000 | |
745 | ||
746 | #define RTMGRP_IPV6_PREFIX 0x20000 | |
747 | ||
748 | /* TC action piece */ | |
749 | struct tcamsg | |
750 | { | |
751 | unsigned char tca_family; | |
752 | unsigned char tca__pad1; | |
753 | unsigned short tca__pad2; | |
754 | }; | |
755 | #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) | |
756 | #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) | |
757 | #define TCA_ACT_TAB 1 /* attr type must be >=1 */ | |
758 | #define TCAA_MAX 1 | |
759 | ||
760 | /* End of information exported to user level */ | |
761 | ||
762 | ||
763 | ||
764 | #endif /* __LINUX_RTNETLINK_H */ |