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