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