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

source code of include/linux/rtnetlink.h