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