GNU Linux-libre 6.9.2-gnu
[releases.git] / include / uapi / linux / rtnetlink.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI__LINUX_RTNETLINK_H
3 #define _UAPI__LINUX_RTNETLINK_H
4
5 #include <linux/types.h>
6 #include <linux/netlink.h>
7 #include <linux/if_link.h>
8 #include <linux/if_addr.h>
9 #include <linux/neighbour.h>
10
11 /* rtnetlink families. Values up to 127 are reserved for real address
12  * families, values above 128 may be used arbitrarily.
13  */
14 #define RTNL_FAMILY_IPMR                128
15 #define RTNL_FAMILY_IP6MR               129
16 #define RTNL_FAMILY_MAX                 129
17
18 /****
19  *              Routing/neighbour discovery messages.
20  ****/
21
22 /* Types of messages */
23
24 enum {
25         RTM_BASE        = 16,
26 #define RTM_BASE        RTM_BASE
27
28         RTM_NEWLINK     = 16,
29 #define RTM_NEWLINK     RTM_NEWLINK
30         RTM_DELLINK,
31 #define RTM_DELLINK     RTM_DELLINK
32         RTM_GETLINK,
33 #define RTM_GETLINK     RTM_GETLINK
34         RTM_SETLINK,
35 #define RTM_SETLINK     RTM_SETLINK
36
37         RTM_NEWADDR     = 20,
38 #define RTM_NEWADDR     RTM_NEWADDR
39         RTM_DELADDR,
40 #define RTM_DELADDR     RTM_DELADDR
41         RTM_GETADDR,
42 #define RTM_GETADDR     RTM_GETADDR
43
44         RTM_NEWROUTE    = 24,
45 #define RTM_NEWROUTE    RTM_NEWROUTE
46         RTM_DELROUTE,
47 #define RTM_DELROUTE    RTM_DELROUTE
48         RTM_GETROUTE,
49 #define RTM_GETROUTE    RTM_GETROUTE
50
51         RTM_NEWNEIGH    = 28,
52 #define RTM_NEWNEIGH    RTM_NEWNEIGH
53         RTM_DELNEIGH,
54 #define RTM_DELNEIGH    RTM_DELNEIGH
55         RTM_GETNEIGH,
56 #define RTM_GETNEIGH    RTM_GETNEIGH
57
58         RTM_NEWRULE     = 32,
59 #define RTM_NEWRULE     RTM_NEWRULE
60         RTM_DELRULE,
61 #define RTM_DELRULE     RTM_DELRULE
62         RTM_GETRULE,
63 #define RTM_GETRULE     RTM_GETRULE
64
65         RTM_NEWQDISC    = 36,
66 #define RTM_NEWQDISC    RTM_NEWQDISC
67         RTM_DELQDISC,
68 #define RTM_DELQDISC    RTM_DELQDISC
69         RTM_GETQDISC,
70 #define RTM_GETQDISC    RTM_GETQDISC
71
72         RTM_NEWTCLASS   = 40,
73 #define RTM_NEWTCLASS   RTM_NEWTCLASS
74         RTM_DELTCLASS,
75 #define RTM_DELTCLASS   RTM_DELTCLASS
76         RTM_GETTCLASS,
77 #define RTM_GETTCLASS   RTM_GETTCLASS
78
79         RTM_NEWTFILTER  = 44,
80 #define RTM_NEWTFILTER  RTM_NEWTFILTER
81         RTM_DELTFILTER,
82 #define RTM_DELTFILTER  RTM_DELTFILTER
83         RTM_GETTFILTER,
84 #define RTM_GETTFILTER  RTM_GETTFILTER
85
86         RTM_NEWACTION   = 48,
87 #define RTM_NEWACTION   RTM_NEWACTION
88         RTM_DELACTION,
89 #define RTM_DELACTION   RTM_DELACTION
90         RTM_GETACTION,
91 #define RTM_GETACTION   RTM_GETACTION
92
93         RTM_NEWPREFIX   = 52,
94 #define RTM_NEWPREFIX   RTM_NEWPREFIX
95
96         RTM_GETMULTICAST = 58,
97 #define RTM_GETMULTICAST RTM_GETMULTICAST
98
99         RTM_GETANYCAST  = 62,
100 #define RTM_GETANYCAST  RTM_GETANYCAST
101
102         RTM_NEWNEIGHTBL = 64,
103 #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
104         RTM_GETNEIGHTBL = 66,
105 #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
106         RTM_SETNEIGHTBL,
107 #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
108
109         RTM_NEWNDUSEROPT = 68,
110 #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
111
112         RTM_NEWADDRLABEL = 72,
113 #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
114         RTM_DELADDRLABEL,
115 #define RTM_DELADDRLABEL RTM_DELADDRLABEL
116         RTM_GETADDRLABEL,
117 #define RTM_GETADDRLABEL RTM_GETADDRLABEL
118
119         RTM_GETDCB = 78,
120 #define RTM_GETDCB RTM_GETDCB
121         RTM_SETDCB,
122 #define RTM_SETDCB RTM_SETDCB
123
124         RTM_NEWNETCONF = 80,
125 #define RTM_NEWNETCONF RTM_NEWNETCONF
126         RTM_DELNETCONF,
127 #define RTM_DELNETCONF RTM_DELNETCONF
128         RTM_GETNETCONF = 82,
129 #define RTM_GETNETCONF RTM_GETNETCONF
130
131         RTM_NEWMDB = 84,
132 #define RTM_NEWMDB RTM_NEWMDB
133         RTM_DELMDB = 85,
134 #define RTM_DELMDB RTM_DELMDB
135         RTM_GETMDB = 86,
136 #define RTM_GETMDB RTM_GETMDB
137
138         RTM_NEWNSID = 88,
139 #define RTM_NEWNSID RTM_NEWNSID
140         RTM_DELNSID = 89,
141 #define RTM_DELNSID RTM_DELNSID
142         RTM_GETNSID = 90,
143 #define RTM_GETNSID RTM_GETNSID
144
145         RTM_NEWSTATS = 92,
146 #define RTM_NEWSTATS RTM_NEWSTATS
147         RTM_GETSTATS = 94,
148 #define RTM_GETSTATS RTM_GETSTATS
149         RTM_SETSTATS,
150 #define RTM_SETSTATS RTM_SETSTATS
151
152         RTM_NEWCACHEREPORT = 96,
153 #define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT
154
155         RTM_NEWCHAIN = 100,
156 #define RTM_NEWCHAIN RTM_NEWCHAIN
157         RTM_DELCHAIN,
158 #define RTM_DELCHAIN RTM_DELCHAIN
159         RTM_GETCHAIN,
160 #define RTM_GETCHAIN RTM_GETCHAIN
161
162         RTM_NEWNEXTHOP = 104,
163 #define RTM_NEWNEXTHOP  RTM_NEWNEXTHOP
164         RTM_DELNEXTHOP,
165 #define RTM_DELNEXTHOP  RTM_DELNEXTHOP
166         RTM_GETNEXTHOP,
167 #define RTM_GETNEXTHOP  RTM_GETNEXTHOP
168
169         RTM_NEWLINKPROP = 108,
170 #define RTM_NEWLINKPROP RTM_NEWLINKPROP
171         RTM_DELLINKPROP,
172 #define RTM_DELLINKPROP RTM_DELLINKPROP
173         RTM_GETLINKPROP,
174 #define RTM_GETLINKPROP RTM_GETLINKPROP
175
176         RTM_NEWVLAN = 112,
177 #define RTM_NEWNVLAN    RTM_NEWVLAN
178         RTM_DELVLAN,
179 #define RTM_DELVLAN     RTM_DELVLAN
180         RTM_GETVLAN,
181 #define RTM_GETVLAN     RTM_GETVLAN
182
183         RTM_NEWNEXTHOPBUCKET = 116,
184 #define RTM_NEWNEXTHOPBUCKET    RTM_NEWNEXTHOPBUCKET
185         RTM_DELNEXTHOPBUCKET,
186 #define RTM_DELNEXTHOPBUCKET    RTM_DELNEXTHOPBUCKET
187         RTM_GETNEXTHOPBUCKET,
188 #define RTM_GETNEXTHOPBUCKET    RTM_GETNEXTHOPBUCKET
189
190         RTM_NEWTUNNEL = 120,
191 #define RTM_NEWTUNNEL   RTM_NEWTUNNEL
192         RTM_DELTUNNEL,
193 #define RTM_DELTUNNEL   RTM_DELTUNNEL
194         RTM_GETTUNNEL,
195 #define RTM_GETTUNNEL   RTM_GETTUNNEL
196
197         __RTM_MAX,
198 #define RTM_MAX         (((__RTM_MAX + 3) & ~3) - 1)
199 };
200
201 #define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE)
202 #define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2)
203 #define RTM_FAM(cmd)    (((cmd) - RTM_BASE) >> 2)
204
205 /* 
206    Generic structure for encapsulation of optional route information.
207    It is reminiscent of sockaddr, but with sa_family replaced
208    with attribute type.
209  */
210
211 struct rtattr {
212         unsigned short  rta_len;
213         unsigned short  rta_type;
214 };
215
216 /* Macros to handle rtattributes */
217
218 #define RTA_ALIGNTO     4U
219 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
220 #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
221                          (rta)->rta_len >= sizeof(struct rtattr) && \
222                          (rta)->rta_len <= (len))
223 #define RTA_NEXT(rta,attrlen)   ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
224                                  (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
225 #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
226 #define RTA_SPACE(len)  RTA_ALIGN(RTA_LENGTH(len))
227 #define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
228 #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
229
230
231
232
233 /******************************************************************************
234  *              Definitions used in routing table administration.
235  ****/
236
237 struct rtmsg {
238         unsigned char           rtm_family;
239         unsigned char           rtm_dst_len;
240         unsigned char           rtm_src_len;
241         unsigned char           rtm_tos;
242
243         unsigned char           rtm_table;      /* Routing table id */
244         unsigned char           rtm_protocol;   /* Routing protocol; see below  */
245         unsigned char           rtm_scope;      /* See below */ 
246         unsigned char           rtm_type;       /* See below    */
247
248         unsigned                rtm_flags;
249 };
250
251 /* rtm_type */
252
253 enum {
254         RTN_UNSPEC,
255         RTN_UNICAST,            /* Gateway or direct route      */
256         RTN_LOCAL,              /* Accept locally               */
257         RTN_BROADCAST,          /* Accept locally as broadcast,
258                                    send as broadcast */
259         RTN_ANYCAST,            /* Accept locally as broadcast,
260                                    but send as unicast */
261         RTN_MULTICAST,          /* Multicast route              */
262         RTN_BLACKHOLE,          /* Drop                         */
263         RTN_UNREACHABLE,        /* Destination is unreachable   */
264         RTN_PROHIBIT,           /* Administratively prohibited  */
265         RTN_THROW,              /* Not in this table            */
266         RTN_NAT,                /* Translate this address       */
267         RTN_XRESOLVE,           /* Use external resolver        */
268         __RTN_MAX
269 };
270
271 #define RTN_MAX (__RTN_MAX - 1)
272
273
274 /* rtm_protocol */
275
276 #define RTPROT_UNSPEC           0
277 #define RTPROT_REDIRECT         1       /* Route installed by ICMP redirects;
278                                            not used by current IPv4 */
279 #define RTPROT_KERNEL           2       /* Route installed by kernel            */
280 #define RTPROT_BOOT             3       /* Route installed during boot          */
281 #define RTPROT_STATIC           4       /* Route installed by administrator     */
282
283 /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
284    they are just passed from user and back as is.
285    It will be used by hypothetical multiple routing daemons.
286    Note that protocol values should be standardized in order to
287    avoid conflicts.
288  */
289
290 #define RTPROT_GATED            8       /* Apparently, GateD */
291 #define RTPROT_RA               9       /* RDISC/ND router advertisements */
292 #define RTPROT_MRT              10      /* Merit MRT */
293 #define RTPROT_ZEBRA            11      /* Zebra */
294 #define RTPROT_BIRD             12      /* BIRD */
295 #define RTPROT_DNROUTED         13      /* DECnet routing daemon */
296 #define RTPROT_XORP             14      /* XORP */
297 #define RTPROT_NTK              15      /* Netsukuku */
298 #define RTPROT_DHCP             16      /* DHCP client */
299 #define RTPROT_MROUTED          17      /* Multicast daemon */
300 #define RTPROT_KEEPALIVED       18      /* Keepalived daemon */
301 #define RTPROT_BABEL            42      /* Babel daemon */
302 #define RTPROT_OPENR            99      /* Open Routing (Open/R) Routes */
303 #define RTPROT_BGP              186     /* BGP Routes */
304 #define RTPROT_ISIS             187     /* ISIS Routes */
305 #define RTPROT_OSPF             188     /* OSPF Routes */
306 #define RTPROT_RIP              189     /* RIP Routes */
307 #define RTPROT_EIGRP            192     /* EIGRP Routes */
308
309 /* rtm_scope
310
311    Really it is not scope, but sort of distance to the destination.
312    NOWHERE are reserved for not existing destinations, HOST is our
313    local addresses, LINK are destinations, located on directly attached
314    link and UNIVERSE is everywhere in the Universe.
315
316    Intermediate values are also possible f.e. interior routes
317    could be assigned a value between UNIVERSE and LINK.
318 */
319
320 enum rt_scope_t {
321         RT_SCOPE_UNIVERSE=0,
322 /* User defined values  */
323         RT_SCOPE_SITE=200,
324         RT_SCOPE_LINK=253,
325         RT_SCOPE_HOST=254,
326         RT_SCOPE_NOWHERE=255
327 };
328
329 /* rtm_flags */
330
331 #define RTM_F_NOTIFY            0x100   /* Notify user of route change  */
332 #define RTM_F_CLONED            0x200   /* This route is cloned         */
333 #define RTM_F_EQUALIZE          0x400   /* Multipath equalizer: NI      */
334 #define RTM_F_PREFIX            0x800   /* Prefix addresses             */
335 #define RTM_F_LOOKUP_TABLE      0x1000  /* set rtm_table to FIB lookup result */
336 #define RTM_F_FIB_MATCH         0x2000  /* return full fib lookup match */
337 #define RTM_F_OFFLOAD           0x4000  /* route is offloaded */
338 #define RTM_F_TRAP              0x8000  /* route is trapping packets */
339 #define RTM_F_OFFLOAD_FAILED    0x20000000 /* route offload failed, this value
340                                             * is chosen to avoid conflicts with
341                                             * other flags defined in
342                                             * include/uapi/linux/ipv6_route.h
343                                             */
344
345 /* Reserved table identifiers */
346
347 enum rt_class_t {
348         RT_TABLE_UNSPEC=0,
349 /* User defined values */
350         RT_TABLE_COMPAT=252,
351         RT_TABLE_DEFAULT=253,
352         RT_TABLE_MAIN=254,
353         RT_TABLE_LOCAL=255,
354         RT_TABLE_MAX=0xFFFFFFFF
355 };
356
357
358 /* Routing message attributes */
359
360 enum rtattr_type_t {
361         RTA_UNSPEC,
362         RTA_DST,
363         RTA_SRC,
364         RTA_IIF,
365         RTA_OIF,
366         RTA_GATEWAY,
367         RTA_PRIORITY,
368         RTA_PREFSRC,
369         RTA_METRICS,
370         RTA_MULTIPATH,
371         RTA_PROTOINFO, /* no longer used */
372         RTA_FLOW,
373         RTA_CACHEINFO,
374         RTA_SESSION, /* no longer used */
375         RTA_MP_ALGO, /* no longer used */
376         RTA_TABLE,
377         RTA_MARK,
378         RTA_MFC_STATS,
379         RTA_VIA,
380         RTA_NEWDST,
381         RTA_PREF,
382         RTA_ENCAP_TYPE,
383         RTA_ENCAP,
384         RTA_EXPIRES,
385         RTA_PAD,
386         RTA_UID,
387         RTA_TTL_PROPAGATE,
388         RTA_IP_PROTO,
389         RTA_SPORT,
390         RTA_DPORT,
391         RTA_NH_ID,
392         __RTA_MAX
393 };
394
395 #define RTA_MAX (__RTA_MAX - 1)
396
397 #define RTM_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
398 #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
399
400 /* RTM_MULTIPATH --- array of struct rtnexthop.
401  *
402  * "struct rtnexthop" describes all necessary nexthop information,
403  * i.e. parameters of path to a destination via this nexthop.
404  *
405  * At the moment it is impossible to set different prefsrc, mtu, window
406  * and rtt for different paths from multipath.
407  */
408
409 struct rtnexthop {
410         unsigned short          rtnh_len;
411         unsigned char           rtnh_flags;
412         unsigned char           rtnh_hops;
413         int                     rtnh_ifindex;
414 };
415
416 /* rtnh_flags */
417
418 #define RTNH_F_DEAD             1       /* Nexthop is dead (used by multipath)  */
419 #define RTNH_F_PERVASIVE        2       /* Do recursive gateway lookup  */
420 #define RTNH_F_ONLINK           4       /* Gateway is forced on link    */
421 #define RTNH_F_OFFLOAD          8       /* Nexthop is offloaded */
422 #define RTNH_F_LINKDOWN         16      /* carrier-down on nexthop */
423 #define RTNH_F_UNRESOLVED       32      /* The entry is unresolved (ipmr) */
424 #define RTNH_F_TRAP             64      /* Nexthop is trapping packets */
425
426 #define RTNH_COMPARE_MASK       (RTNH_F_DEAD | RTNH_F_LINKDOWN | \
427                                  RTNH_F_OFFLOAD | RTNH_F_TRAP)
428
429 /* Macros to handle hexthops */
430
431 #define RTNH_ALIGNTO    4
432 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) )
433 #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
434                            ((int)(rtnh)->rtnh_len) <= (len))
435 #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
436 #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len))
437 #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len))
438 #define RTNH_DATA(rtnh)   ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
439
440 /* RTA_VIA */
441 struct rtvia {
442         __kernel_sa_family_t    rtvia_family;
443         __u8                    rtvia_addr[];
444 };
445
446 /* RTM_CACHEINFO */
447
448 struct rta_cacheinfo {
449         __u32   rta_clntref;
450         __u32   rta_lastuse;
451         __s32   rta_expires;
452         __u32   rta_error;
453         __u32   rta_used;
454
455 #define RTNETLINK_HAVE_PEERINFO 1
456         __u32   rta_id;
457         __u32   rta_ts;
458         __u32   rta_tsage;
459 };
460
461 /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
462
463 enum {
464         RTAX_UNSPEC,
465 #define RTAX_UNSPEC RTAX_UNSPEC
466         RTAX_LOCK,
467 #define RTAX_LOCK RTAX_LOCK
468         RTAX_MTU,
469 #define RTAX_MTU RTAX_MTU
470         RTAX_WINDOW,
471 #define RTAX_WINDOW RTAX_WINDOW
472         RTAX_RTT,
473 #define RTAX_RTT RTAX_RTT
474         RTAX_RTTVAR,
475 #define RTAX_RTTVAR RTAX_RTTVAR
476         RTAX_SSTHRESH,
477 #define RTAX_SSTHRESH RTAX_SSTHRESH
478         RTAX_CWND,
479 #define RTAX_CWND RTAX_CWND
480         RTAX_ADVMSS,
481 #define RTAX_ADVMSS RTAX_ADVMSS
482         RTAX_REORDERING,
483 #define RTAX_REORDERING RTAX_REORDERING
484         RTAX_HOPLIMIT,
485 #define RTAX_HOPLIMIT RTAX_HOPLIMIT
486         RTAX_INITCWND,
487 #define RTAX_INITCWND RTAX_INITCWND
488         RTAX_FEATURES,
489 #define RTAX_FEATURES RTAX_FEATURES
490         RTAX_RTO_MIN,
491 #define RTAX_RTO_MIN RTAX_RTO_MIN
492         RTAX_INITRWND,
493 #define RTAX_INITRWND RTAX_INITRWND
494         RTAX_QUICKACK,
495 #define RTAX_QUICKACK RTAX_QUICKACK
496         RTAX_CC_ALGO,
497 #define RTAX_CC_ALGO RTAX_CC_ALGO
498         RTAX_FASTOPEN_NO_COOKIE,
499 #define RTAX_FASTOPEN_NO_COOKIE RTAX_FASTOPEN_NO_COOKIE
500         __RTAX_MAX
501 };
502
503 #define RTAX_MAX (__RTAX_MAX - 1)
504
505 #define RTAX_FEATURE_ECN                (1 << 0)
506 #define RTAX_FEATURE_SACK               (1 << 1) /* unused */
507 #define RTAX_FEATURE_TIMESTAMP          (1 << 2) /* unused */
508 #define RTAX_FEATURE_ALLFRAG            (1 << 3) /* unused */
509 #define RTAX_FEATURE_TCP_USEC_TS        (1 << 4)
510
511 #define RTAX_FEATURE_MASK       (RTAX_FEATURE_ECN |             \
512                                  RTAX_FEATURE_SACK |            \
513                                  RTAX_FEATURE_TIMESTAMP |       \
514                                  RTAX_FEATURE_ALLFRAG |         \
515                                  RTAX_FEATURE_TCP_USEC_TS)
516
517 struct rta_session {
518         __u8    proto;
519         __u8    pad1;
520         __u16   pad2;
521
522         union {
523                 struct {
524                         __u16   sport;
525                         __u16   dport;
526                 } ports;
527
528                 struct {
529                         __u8    type;
530                         __u8    code;
531                         __u16   ident;
532                 } icmpt;
533
534                 __u32           spi;
535         } u;
536 };
537
538 struct rta_mfc_stats {
539         __u64   mfcs_packets;
540         __u64   mfcs_bytes;
541         __u64   mfcs_wrong_if;
542 };
543
544 /****
545  *              General form of address family dependent message.
546  ****/
547
548 struct rtgenmsg {
549         unsigned char           rtgen_family;
550 };
551
552 /*****************************************************************
553  *              Link layer specific messages.
554  ****/
555
556 /* struct ifinfomsg
557  * passes link level specific information, not dependent
558  * on network protocol.
559  */
560
561 struct ifinfomsg {
562         unsigned char   ifi_family;
563         unsigned char   __ifi_pad;
564         unsigned short  ifi_type;               /* ARPHRD_* */
565         int             ifi_index;              /* Link index   */
566         unsigned        ifi_flags;              /* IFF_* flags  */
567         unsigned        ifi_change;             /* IFF_* change mask */
568 };
569
570 /********************************************************************
571  *              prefix information 
572  ****/
573
574 struct prefixmsg {
575         unsigned char   prefix_family;
576         unsigned char   prefix_pad1;
577         unsigned short  prefix_pad2;
578         int             prefix_ifindex;
579         unsigned char   prefix_type;
580         unsigned char   prefix_len;
581         unsigned char   prefix_flags;
582         unsigned char   prefix_pad3;
583 };
584
585 enum 
586 {
587         PREFIX_UNSPEC,
588         PREFIX_ADDRESS,
589         PREFIX_CACHEINFO,
590         __PREFIX_MAX
591 };
592
593 #define PREFIX_MAX      (__PREFIX_MAX - 1)
594
595 struct prefix_cacheinfo {
596         __u32   preferred_time;
597         __u32   valid_time;
598 };
599
600
601 /*****************************************************************
602  *              Traffic control messages.
603  ****/
604
605 struct tcmsg {
606         unsigned char   tcm_family;
607         unsigned char   tcm__pad1;
608         unsigned short  tcm__pad2;
609         int             tcm_ifindex;
610         __u32           tcm_handle;
611         __u32           tcm_parent;
612 /* tcm_block_index is used instead of tcm_parent
613  * in case tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK
614  */
615 #define tcm_block_index tcm_parent
616         __u32           tcm_info;
617 };
618
619 /* For manipulation of filters in shared block, tcm_ifindex is set to
620  * TCM_IFINDEX_MAGIC_BLOCK, and tcm_parent is aliased to tcm_block_index
621  * which is the block index.
622  */
623 #define TCM_IFINDEX_MAGIC_BLOCK (0xFFFFFFFFU)
624
625 enum {
626         TCA_UNSPEC,
627         TCA_KIND,
628         TCA_OPTIONS,
629         TCA_STATS,
630         TCA_XSTATS,
631         TCA_RATE,
632         TCA_FCNT,
633         TCA_STATS2,
634         TCA_STAB,
635         TCA_PAD,
636         TCA_DUMP_INVISIBLE,
637         TCA_CHAIN,
638         TCA_HW_OFFLOAD,
639         TCA_INGRESS_BLOCK,
640         TCA_EGRESS_BLOCK,
641         TCA_DUMP_FLAGS,
642         TCA_EXT_WARN_MSG,
643         __TCA_MAX
644 };
645
646 #define TCA_MAX (__TCA_MAX - 1)
647
648 #define TCA_DUMP_FLAGS_TERSE (1 << 0) /* Means that in dump user gets only basic
649                                        * data necessary to identify the objects
650                                        * (handle, cookie, etc.) and stats.
651                                        */
652
653 #define TCA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
654 #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
655
656 /********************************************************************
657  *              Neighbor Discovery userland options
658  ****/
659
660 struct nduseroptmsg {
661         unsigned char   nduseropt_family;
662         unsigned char   nduseropt_pad1;
663         unsigned short  nduseropt_opts_len;     /* Total length of options */
664         int             nduseropt_ifindex;
665         __u8            nduseropt_icmp_type;
666         __u8            nduseropt_icmp_code;
667         unsigned short  nduseropt_pad2;
668         unsigned int    nduseropt_pad3;
669         /* Followed by one or more ND options */
670 };
671
672 enum {
673         NDUSEROPT_UNSPEC,
674         NDUSEROPT_SRCADDR,
675         __NDUSEROPT_MAX
676 };
677
678 #define NDUSEROPT_MAX   (__NDUSEROPT_MAX - 1)
679
680 #ifndef __KERNEL__
681 /* RTnetlink multicast groups - backwards compatibility for userspace */
682 #define RTMGRP_LINK             1
683 #define RTMGRP_NOTIFY           2
684 #define RTMGRP_NEIGH            4
685 #define RTMGRP_TC               8
686
687 #define RTMGRP_IPV4_IFADDR      0x10
688 #define RTMGRP_IPV4_MROUTE      0x20
689 #define RTMGRP_IPV4_ROUTE       0x40
690 #define RTMGRP_IPV4_RULE        0x80
691
692 #define RTMGRP_IPV6_IFADDR      0x100
693 #define RTMGRP_IPV6_MROUTE      0x200
694 #define RTMGRP_IPV6_ROUTE       0x400
695 #define RTMGRP_IPV6_IFINFO      0x800
696
697 #define RTMGRP_DECnet_IFADDR    0x1000
698 #define RTMGRP_DECnet_ROUTE     0x4000
699
700 #define RTMGRP_IPV6_PREFIX      0x20000
701 #endif
702
703 /* RTnetlink multicast groups */
704 enum rtnetlink_groups {
705         RTNLGRP_NONE,
706 #define RTNLGRP_NONE            RTNLGRP_NONE
707         RTNLGRP_LINK,
708 #define RTNLGRP_LINK            RTNLGRP_LINK
709         RTNLGRP_NOTIFY,
710 #define RTNLGRP_NOTIFY          RTNLGRP_NOTIFY
711         RTNLGRP_NEIGH,
712 #define RTNLGRP_NEIGH           RTNLGRP_NEIGH
713         RTNLGRP_TC,
714 #define RTNLGRP_TC              RTNLGRP_TC
715         RTNLGRP_IPV4_IFADDR,
716 #define RTNLGRP_IPV4_IFADDR     RTNLGRP_IPV4_IFADDR
717         RTNLGRP_IPV4_MROUTE,
718 #define RTNLGRP_IPV4_MROUTE     RTNLGRP_IPV4_MROUTE
719         RTNLGRP_IPV4_ROUTE,
720 #define RTNLGRP_IPV4_ROUTE      RTNLGRP_IPV4_ROUTE
721         RTNLGRP_IPV4_RULE,
722 #define RTNLGRP_IPV4_RULE       RTNLGRP_IPV4_RULE
723         RTNLGRP_IPV6_IFADDR,
724 #define RTNLGRP_IPV6_IFADDR     RTNLGRP_IPV6_IFADDR
725         RTNLGRP_IPV6_MROUTE,
726 #define RTNLGRP_IPV6_MROUTE     RTNLGRP_IPV6_MROUTE
727         RTNLGRP_IPV6_ROUTE,
728 #define RTNLGRP_IPV6_ROUTE      RTNLGRP_IPV6_ROUTE
729         RTNLGRP_IPV6_IFINFO,
730 #define RTNLGRP_IPV6_IFINFO     RTNLGRP_IPV6_IFINFO
731         RTNLGRP_DECnet_IFADDR,
732 #define RTNLGRP_DECnet_IFADDR   RTNLGRP_DECnet_IFADDR
733         RTNLGRP_NOP2,
734         RTNLGRP_DECnet_ROUTE,
735 #define RTNLGRP_DECnet_ROUTE    RTNLGRP_DECnet_ROUTE
736         RTNLGRP_DECnet_RULE,
737 #define RTNLGRP_DECnet_RULE     RTNLGRP_DECnet_RULE
738         RTNLGRP_NOP4,
739         RTNLGRP_IPV6_PREFIX,
740 #define RTNLGRP_IPV6_PREFIX     RTNLGRP_IPV6_PREFIX
741         RTNLGRP_IPV6_RULE,
742 #define RTNLGRP_IPV6_RULE       RTNLGRP_IPV6_RULE
743         RTNLGRP_ND_USEROPT,
744 #define RTNLGRP_ND_USEROPT      RTNLGRP_ND_USEROPT
745         RTNLGRP_PHONET_IFADDR,
746 #define RTNLGRP_PHONET_IFADDR   RTNLGRP_PHONET_IFADDR
747         RTNLGRP_PHONET_ROUTE,
748 #define RTNLGRP_PHONET_ROUTE    RTNLGRP_PHONET_ROUTE
749         RTNLGRP_DCB,
750 #define RTNLGRP_DCB             RTNLGRP_DCB
751         RTNLGRP_IPV4_NETCONF,
752 #define RTNLGRP_IPV4_NETCONF    RTNLGRP_IPV4_NETCONF
753         RTNLGRP_IPV6_NETCONF,
754 #define RTNLGRP_IPV6_NETCONF    RTNLGRP_IPV6_NETCONF
755         RTNLGRP_MDB,
756 #define RTNLGRP_MDB             RTNLGRP_MDB
757         RTNLGRP_MPLS_ROUTE,
758 #define RTNLGRP_MPLS_ROUTE      RTNLGRP_MPLS_ROUTE
759         RTNLGRP_NSID,
760 #define RTNLGRP_NSID            RTNLGRP_NSID
761         RTNLGRP_MPLS_NETCONF,
762 #define RTNLGRP_MPLS_NETCONF    RTNLGRP_MPLS_NETCONF
763         RTNLGRP_IPV4_MROUTE_R,
764 #define RTNLGRP_IPV4_MROUTE_R   RTNLGRP_IPV4_MROUTE_R
765         RTNLGRP_IPV6_MROUTE_R,
766 #define RTNLGRP_IPV6_MROUTE_R   RTNLGRP_IPV6_MROUTE_R
767         RTNLGRP_NEXTHOP,
768 #define RTNLGRP_NEXTHOP         RTNLGRP_NEXTHOP
769         RTNLGRP_BRVLAN,
770 #define RTNLGRP_BRVLAN          RTNLGRP_BRVLAN
771         RTNLGRP_MCTP_IFADDR,
772 #define RTNLGRP_MCTP_IFADDR     RTNLGRP_MCTP_IFADDR
773         RTNLGRP_TUNNEL,
774 #define RTNLGRP_TUNNEL          RTNLGRP_TUNNEL
775         RTNLGRP_STATS,
776 #define RTNLGRP_STATS           RTNLGRP_STATS
777         __RTNLGRP_MAX
778 };
779 #define RTNLGRP_MAX     (__RTNLGRP_MAX - 1)
780
781 /* TC action piece */
782 struct tcamsg {
783         unsigned char   tca_family;
784         unsigned char   tca__pad1;
785         unsigned short  tca__pad2;
786 };
787
788 enum {
789         TCA_ROOT_UNSPEC,
790         TCA_ROOT_TAB,
791 #define TCA_ACT_TAB TCA_ROOT_TAB
792 #define TCAA_MAX TCA_ROOT_TAB
793         TCA_ROOT_FLAGS,
794         TCA_ROOT_COUNT,
795         TCA_ROOT_TIME_DELTA, /* in msecs */
796         TCA_ROOT_EXT_WARN_MSG,
797         __TCA_ROOT_MAX,
798 #define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
799 };
800
801 #define TA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
802 #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
803 /* tcamsg flags stored in attribute TCA_ROOT_FLAGS
804  *
805  * TCA_ACT_FLAG_LARGE_DUMP_ON user->kernel to request for larger than
806  * TCA_ACT_MAX_PRIO actions in a dump. All dump responses will contain the
807  * number of actions being dumped stored in for user app's consumption in
808  * TCA_ROOT_COUNT
809  *
810  * TCA_ACT_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
811  * includes essential action info (kind, index, etc.)
812  *
813  */
814 #define TCA_FLAG_LARGE_DUMP_ON          (1 << 0)
815 #define TCA_ACT_FLAG_LARGE_DUMP_ON      TCA_FLAG_LARGE_DUMP_ON
816 #define TCA_ACT_FLAG_TERSE_DUMP         (1 << 1)
817
818 /* New extended info filters for IFLA_EXT_MASK */
819 #define RTEXT_FILTER_VF         (1 << 0)
820 #define RTEXT_FILTER_BRVLAN     (1 << 1)
821 #define RTEXT_FILTER_BRVLAN_COMPRESSED  (1 << 2)
822 #define RTEXT_FILTER_SKIP_STATS (1 << 3)
823 #define RTEXT_FILTER_MRP        (1 << 4)
824 #define RTEXT_FILTER_CFM_CONFIG (1 << 5)
825 #define RTEXT_FILTER_CFM_STATUS (1 << 6)
826 #define RTEXT_FILTER_MST        (1 << 7)
827
828 /* End of information exported to user level */
829
830
831
832 #endif /* _UAPI__LINUX_RTNETLINK_H */