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