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