xref: /openbmc/linux/include/uapi/linux/rtnetlink.h (revision 710ec562)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _UAPI__LINUX_RTNETLINK_H
3607ca46eSDavid Howells #define _UAPI__LINUX_RTNETLINK_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells #include <linux/netlink.h>
7607ca46eSDavid Howells #include <linux/if_link.h>
8607ca46eSDavid Howells #include <linux/if_addr.h>
9607ca46eSDavid Howells #include <linux/neighbour.h>
10607ca46eSDavid Howells 
11607ca46eSDavid Howells /* rtnetlink families. Values up to 127 are reserved for real address
12607ca46eSDavid Howells  * families, values above 128 may be used arbitrarily.
13607ca46eSDavid Howells  */
14607ca46eSDavid Howells #define RTNL_FAMILY_IPMR		128
15607ca46eSDavid Howells #define RTNL_FAMILY_IP6MR		129
16607ca46eSDavid Howells #define RTNL_FAMILY_MAX			129
17607ca46eSDavid Howells 
18607ca46eSDavid Howells /****
19607ca46eSDavid Howells  *		Routing/neighbour discovery messages.
20607ca46eSDavid Howells  ****/
21607ca46eSDavid Howells 
22607ca46eSDavid Howells /* Types of messages */
23607ca46eSDavid Howells 
24607ca46eSDavid Howells enum {
25607ca46eSDavid Howells 	RTM_BASE	= 16,
26607ca46eSDavid Howells #define RTM_BASE	RTM_BASE
27607ca46eSDavid Howells 
28607ca46eSDavid Howells 	RTM_NEWLINK	= 16,
29607ca46eSDavid Howells #define RTM_NEWLINK	RTM_NEWLINK
30607ca46eSDavid Howells 	RTM_DELLINK,
31607ca46eSDavid Howells #define RTM_DELLINK	RTM_DELLINK
32607ca46eSDavid Howells 	RTM_GETLINK,
33607ca46eSDavid Howells #define RTM_GETLINK	RTM_GETLINK
34607ca46eSDavid Howells 	RTM_SETLINK,
35607ca46eSDavid Howells #define RTM_SETLINK	RTM_SETLINK
36607ca46eSDavid Howells 
37607ca46eSDavid Howells 	RTM_NEWADDR	= 20,
38607ca46eSDavid Howells #define RTM_NEWADDR	RTM_NEWADDR
39607ca46eSDavid Howells 	RTM_DELADDR,
40607ca46eSDavid Howells #define RTM_DELADDR	RTM_DELADDR
41607ca46eSDavid Howells 	RTM_GETADDR,
42607ca46eSDavid Howells #define RTM_GETADDR	RTM_GETADDR
43607ca46eSDavid Howells 
44607ca46eSDavid Howells 	RTM_NEWROUTE	= 24,
45607ca46eSDavid Howells #define RTM_NEWROUTE	RTM_NEWROUTE
46607ca46eSDavid Howells 	RTM_DELROUTE,
47607ca46eSDavid Howells #define RTM_DELROUTE	RTM_DELROUTE
48607ca46eSDavid Howells 	RTM_GETROUTE,
49607ca46eSDavid Howells #define RTM_GETROUTE	RTM_GETROUTE
50607ca46eSDavid Howells 
51607ca46eSDavid Howells 	RTM_NEWNEIGH	= 28,
52607ca46eSDavid Howells #define RTM_NEWNEIGH	RTM_NEWNEIGH
53607ca46eSDavid Howells 	RTM_DELNEIGH,
54607ca46eSDavid Howells #define RTM_DELNEIGH	RTM_DELNEIGH
55607ca46eSDavid Howells 	RTM_GETNEIGH,
56607ca46eSDavid Howells #define RTM_GETNEIGH	RTM_GETNEIGH
57607ca46eSDavid Howells 
58607ca46eSDavid Howells 	RTM_NEWRULE	= 32,
59607ca46eSDavid Howells #define RTM_NEWRULE	RTM_NEWRULE
60607ca46eSDavid Howells 	RTM_DELRULE,
61607ca46eSDavid Howells #define RTM_DELRULE	RTM_DELRULE
62607ca46eSDavid Howells 	RTM_GETRULE,
63607ca46eSDavid Howells #define RTM_GETRULE	RTM_GETRULE
64607ca46eSDavid Howells 
65607ca46eSDavid Howells 	RTM_NEWQDISC	= 36,
66607ca46eSDavid Howells #define RTM_NEWQDISC	RTM_NEWQDISC
67607ca46eSDavid Howells 	RTM_DELQDISC,
68607ca46eSDavid Howells #define RTM_DELQDISC	RTM_DELQDISC
69607ca46eSDavid Howells 	RTM_GETQDISC,
70607ca46eSDavid Howells #define RTM_GETQDISC	RTM_GETQDISC
71607ca46eSDavid Howells 
72607ca46eSDavid Howells 	RTM_NEWTCLASS	= 40,
73607ca46eSDavid Howells #define RTM_NEWTCLASS	RTM_NEWTCLASS
74607ca46eSDavid Howells 	RTM_DELTCLASS,
75607ca46eSDavid Howells #define RTM_DELTCLASS	RTM_DELTCLASS
76607ca46eSDavid Howells 	RTM_GETTCLASS,
77607ca46eSDavid Howells #define RTM_GETTCLASS	RTM_GETTCLASS
78607ca46eSDavid Howells 
79607ca46eSDavid Howells 	RTM_NEWTFILTER	= 44,
80607ca46eSDavid Howells #define RTM_NEWTFILTER	RTM_NEWTFILTER
81607ca46eSDavid Howells 	RTM_DELTFILTER,
82607ca46eSDavid Howells #define RTM_DELTFILTER	RTM_DELTFILTER
83607ca46eSDavid Howells 	RTM_GETTFILTER,
84607ca46eSDavid Howells #define RTM_GETTFILTER	RTM_GETTFILTER
85607ca46eSDavid Howells 
86607ca46eSDavid Howells 	RTM_NEWACTION	= 48,
87607ca46eSDavid Howells #define RTM_NEWACTION   RTM_NEWACTION
88607ca46eSDavid Howells 	RTM_DELACTION,
89607ca46eSDavid Howells #define RTM_DELACTION   RTM_DELACTION
90607ca46eSDavid Howells 	RTM_GETACTION,
91607ca46eSDavid Howells #define RTM_GETACTION   RTM_GETACTION
92607ca46eSDavid Howells 
93607ca46eSDavid Howells 	RTM_NEWPREFIX	= 52,
94607ca46eSDavid Howells #define RTM_NEWPREFIX	RTM_NEWPREFIX
95607ca46eSDavid Howells 
96607ca46eSDavid Howells 	RTM_GETMULTICAST = 58,
97607ca46eSDavid Howells #define RTM_GETMULTICAST RTM_GETMULTICAST
98607ca46eSDavid Howells 
99607ca46eSDavid Howells 	RTM_GETANYCAST	= 62,
100607ca46eSDavid Howells #define RTM_GETANYCAST	RTM_GETANYCAST
101607ca46eSDavid Howells 
102607ca46eSDavid Howells 	RTM_NEWNEIGHTBL	= 64,
103607ca46eSDavid Howells #define RTM_NEWNEIGHTBL	RTM_NEWNEIGHTBL
104607ca46eSDavid Howells 	RTM_GETNEIGHTBL	= 66,
105607ca46eSDavid Howells #define RTM_GETNEIGHTBL	RTM_GETNEIGHTBL
106607ca46eSDavid Howells 	RTM_SETNEIGHTBL,
107607ca46eSDavid Howells #define RTM_SETNEIGHTBL	RTM_SETNEIGHTBL
108607ca46eSDavid Howells 
109607ca46eSDavid Howells 	RTM_NEWNDUSEROPT = 68,
110607ca46eSDavid Howells #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
111607ca46eSDavid Howells 
112607ca46eSDavid Howells 	RTM_NEWADDRLABEL = 72,
113607ca46eSDavid Howells #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
114607ca46eSDavid Howells 	RTM_DELADDRLABEL,
115607ca46eSDavid Howells #define RTM_DELADDRLABEL RTM_DELADDRLABEL
116607ca46eSDavid Howells 	RTM_GETADDRLABEL,
117607ca46eSDavid Howells #define RTM_GETADDRLABEL RTM_GETADDRLABEL
118607ca46eSDavid Howells 
119607ca46eSDavid Howells 	RTM_GETDCB = 78,
120607ca46eSDavid Howells #define RTM_GETDCB RTM_GETDCB
121607ca46eSDavid Howells 	RTM_SETDCB,
122607ca46eSDavid Howells #define RTM_SETDCB RTM_SETDCB
123607ca46eSDavid Howells 
124d900082bSNicolas Dichtel 	RTM_NEWNETCONF = 80,
125d900082bSNicolas Dichtel #define RTM_NEWNETCONF RTM_NEWNETCONF
126983701ebSDavid Ahern 	RTM_DELNETCONF,
127983701ebSDavid Ahern #define RTM_DELNETCONF RTM_DELNETCONF
128d900082bSNicolas Dichtel 	RTM_GETNETCONF = 82,
129d900082bSNicolas Dichtel #define RTM_GETNETCONF RTM_GETNETCONF
130d900082bSNicolas Dichtel 
13137a393bcSCong Wang 	RTM_NEWMDB = 84,
13237a393bcSCong Wang #define RTM_NEWMDB RTM_NEWMDB
13337a393bcSCong Wang 	RTM_DELMDB = 85,
13437a393bcSCong Wang #define RTM_DELMDB RTM_DELMDB
135ee07c6e7SCong Wang 	RTM_GETMDB = 86,
136ee07c6e7SCong Wang #define RTM_GETMDB RTM_GETMDB
137ee07c6e7SCong Wang 
1380c7aecd4SNicolas Dichtel 	RTM_NEWNSID = 88,
1390c7aecd4SNicolas Dichtel #define RTM_NEWNSID RTM_NEWNSID
1409a963454SNicolas Dichtel 	RTM_DELNSID = 89,
1419a963454SNicolas Dichtel #define RTM_DELNSID RTM_DELNSID
1420c7aecd4SNicolas Dichtel 	RTM_GETNSID = 90,
1430c7aecd4SNicolas Dichtel #define RTM_GETNSID RTM_GETNSID
1440c7aecd4SNicolas Dichtel 
14510c9ead9SRoopa Prabhu 	RTM_NEWSTATS = 92,
14610c9ead9SRoopa Prabhu #define RTM_NEWSTATS RTM_NEWSTATS
14710c9ead9SRoopa Prabhu 	RTM_GETSTATS = 94,
14810c9ead9SRoopa Prabhu #define RTM_GETSTATS RTM_GETSTATS
14910c9ead9SRoopa Prabhu 
15094df30a6SJulien Gomes 	RTM_NEWCACHEREPORT = 96,
15194df30a6SJulien Gomes #define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT
15294df30a6SJulien Gomes 
15332a4f5ecSJiri Pirko 	RTM_NEWCHAIN = 100,
15432a4f5ecSJiri Pirko #define RTM_NEWCHAIN RTM_NEWCHAIN
15532a4f5ecSJiri Pirko 	RTM_DELCHAIN,
15632a4f5ecSJiri Pirko #define RTM_DELCHAIN RTM_DELCHAIN
15732a4f5ecSJiri Pirko 	RTM_GETCHAIN,
15832a4f5ecSJiri Pirko #define RTM_GETCHAIN RTM_GETCHAIN
15932a4f5ecSJiri Pirko 
16065ee00a9SDavid Ahern 	RTM_NEWNEXTHOP = 104,
16165ee00a9SDavid Ahern #define RTM_NEWNEXTHOP	RTM_NEWNEXTHOP
16265ee00a9SDavid Ahern 	RTM_DELNEXTHOP,
16365ee00a9SDavid Ahern #define RTM_DELNEXTHOP	RTM_DELNEXTHOP
16465ee00a9SDavid Ahern 	RTM_GETNEXTHOP,
16565ee00a9SDavid Ahern #define RTM_GETNEXTHOP	RTM_GETNEXTHOP
16665ee00a9SDavid Ahern 
16736fbf1e5SJiri Pirko 	RTM_NEWLINKPROP = 108,
16836fbf1e5SJiri Pirko #define RTM_NEWLINKPROP	RTM_NEWLINKPROP
16936fbf1e5SJiri Pirko 	RTM_DELLINKPROP,
17036fbf1e5SJiri Pirko #define RTM_DELLINKPROP	RTM_DELLINKPROP
17136fbf1e5SJiri Pirko 	RTM_GETLINKPROP,
17236fbf1e5SJiri Pirko #define RTM_GETLINKPROP	RTM_GETLINKPROP
17336fbf1e5SJiri Pirko 
1748dcea187SNikolay Aleksandrov 	RTM_NEWVLAN = 112,
1758dcea187SNikolay Aleksandrov #define RTM_NEWNVLAN	RTM_NEWVLAN
1768dcea187SNikolay Aleksandrov 	RTM_DELVLAN,
1778dcea187SNikolay Aleksandrov #define RTM_DELVLAN	RTM_DELVLAN
1788dcea187SNikolay Aleksandrov 	RTM_GETVLAN,
1798dcea187SNikolay Aleksandrov #define RTM_GETVLAN	RTM_GETVLAN
1808dcea187SNikolay Aleksandrov 
181*710ec562SIdo Schimmel 	RTM_NEWNEXTHOPBUCKET = 116,
182*710ec562SIdo Schimmel #define RTM_NEWNEXTHOPBUCKET	RTM_NEWNEXTHOPBUCKET
183*710ec562SIdo Schimmel 	RTM_DELNEXTHOPBUCKET,
184*710ec562SIdo Schimmel #define RTM_DELNEXTHOPBUCKET	RTM_DELNEXTHOPBUCKET
185*710ec562SIdo Schimmel 	RTM_GETNEXTHOPBUCKET,
186*710ec562SIdo Schimmel #define RTM_GETNEXTHOPBUCKET	RTM_GETNEXTHOPBUCKET
187*710ec562SIdo Schimmel 
188607ca46eSDavid Howells 	__RTM_MAX,
189607ca46eSDavid Howells #define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
190607ca46eSDavid Howells };
191607ca46eSDavid Howells 
192607ca46eSDavid Howells #define RTM_NR_MSGTYPES	(RTM_MAX + 1 - RTM_BASE)
193607ca46eSDavid Howells #define RTM_NR_FAMILIES	(RTM_NR_MSGTYPES >> 2)
194607ca46eSDavid Howells #define RTM_FAM(cmd)	(((cmd) - RTM_BASE) >> 2)
195607ca46eSDavid Howells 
196607ca46eSDavid Howells /*
197607ca46eSDavid Howells    Generic structure for encapsulation of optional route information.
198607ca46eSDavid Howells    It is reminiscent of sockaddr, but with sa_family replaced
199607ca46eSDavid Howells    with attribute type.
200607ca46eSDavid Howells  */
201607ca46eSDavid Howells 
202607ca46eSDavid Howells struct rtattr {
203607ca46eSDavid Howells 	unsigned short	rta_len;
204607ca46eSDavid Howells 	unsigned short	rta_type;
205607ca46eSDavid Howells };
206607ca46eSDavid Howells 
207607ca46eSDavid Howells /* Macros to handle rtattributes */
208607ca46eSDavid Howells 
209e8444637SArad, Ronen #define RTA_ALIGNTO	4U
210607ca46eSDavid Howells #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
211607ca46eSDavid Howells #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
212607ca46eSDavid Howells 			 (rta)->rta_len >= sizeof(struct rtattr) && \
213607ca46eSDavid Howells 			 (rta)->rta_len <= (len))
214607ca46eSDavid Howells #define RTA_NEXT(rta,attrlen)	((attrlen) -= RTA_ALIGN((rta)->rta_len), \
215607ca46eSDavid Howells 				 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
216607ca46eSDavid Howells #define RTA_LENGTH(len)	(RTA_ALIGN(sizeof(struct rtattr)) + (len))
217607ca46eSDavid Howells #define RTA_SPACE(len)	RTA_ALIGN(RTA_LENGTH(len))
218607ca46eSDavid Howells #define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
219607ca46eSDavid Howells #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
220607ca46eSDavid Howells 
221607ca46eSDavid Howells 
222607ca46eSDavid Howells 
223607ca46eSDavid Howells 
224607ca46eSDavid Howells /******************************************************************************
225607ca46eSDavid Howells  *		Definitions used in routing table administration.
226607ca46eSDavid Howells  ****/
227607ca46eSDavid Howells 
228607ca46eSDavid Howells struct rtmsg {
229607ca46eSDavid Howells 	unsigned char		rtm_family;
230607ca46eSDavid Howells 	unsigned char		rtm_dst_len;
231607ca46eSDavid Howells 	unsigned char		rtm_src_len;
232607ca46eSDavid Howells 	unsigned char		rtm_tos;
233607ca46eSDavid Howells 
234607ca46eSDavid Howells 	unsigned char		rtm_table;	/* Routing table id */
235607ca46eSDavid Howells 	unsigned char		rtm_protocol;	/* Routing protocol; see below	*/
236607ca46eSDavid Howells 	unsigned char		rtm_scope;	/* See below */
237607ca46eSDavid Howells 	unsigned char		rtm_type;	/* See below	*/
238607ca46eSDavid Howells 
239607ca46eSDavid Howells 	unsigned		rtm_flags;
240607ca46eSDavid Howells };
241607ca46eSDavid Howells 
242607ca46eSDavid Howells /* rtm_type */
243607ca46eSDavid Howells 
244607ca46eSDavid Howells enum {
245607ca46eSDavid Howells 	RTN_UNSPEC,
246607ca46eSDavid Howells 	RTN_UNICAST,		/* Gateway or direct route	*/
247607ca46eSDavid Howells 	RTN_LOCAL,		/* Accept locally		*/
248607ca46eSDavid Howells 	RTN_BROADCAST,		/* Accept locally as broadcast,
249607ca46eSDavid Howells 				   send as broadcast */
250607ca46eSDavid Howells 	RTN_ANYCAST,		/* Accept locally as broadcast,
251607ca46eSDavid Howells 				   but send as unicast */
252607ca46eSDavid Howells 	RTN_MULTICAST,		/* Multicast route		*/
253607ca46eSDavid Howells 	RTN_BLACKHOLE,		/* Drop				*/
254607ca46eSDavid Howells 	RTN_UNREACHABLE,	/* Destination is unreachable   */
255607ca46eSDavid Howells 	RTN_PROHIBIT,		/* Administratively prohibited	*/
256607ca46eSDavid Howells 	RTN_THROW,		/* Not in this table		*/
257607ca46eSDavid Howells 	RTN_NAT,		/* Translate this address	*/
258607ca46eSDavid Howells 	RTN_XRESOLVE,		/* Use external resolver	*/
259607ca46eSDavid Howells 	__RTN_MAX
260607ca46eSDavid Howells };
261607ca46eSDavid Howells 
262607ca46eSDavid Howells #define RTN_MAX (__RTN_MAX - 1)
263607ca46eSDavid Howells 
264607ca46eSDavid Howells 
265607ca46eSDavid Howells /* rtm_protocol */
266607ca46eSDavid Howells 
267607ca46eSDavid Howells #define RTPROT_UNSPEC		0
268607ca46eSDavid Howells #define RTPROT_REDIRECT		1	/* Route installed by ICMP redirects;
269607ca46eSDavid Howells 					   not used by current IPv4 */
270607ca46eSDavid Howells #define RTPROT_KERNEL		2	/* Route installed by kernel		*/
271607ca46eSDavid Howells #define RTPROT_BOOT		3	/* Route installed during boot		*/
272607ca46eSDavid Howells #define RTPROT_STATIC		4	/* Route installed by administrator	*/
273607ca46eSDavid Howells 
274607ca46eSDavid Howells /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
275607ca46eSDavid Howells    they are just passed from user and back as is.
276607ca46eSDavid Howells    It will be used by hypothetical multiple routing daemons.
277607ca46eSDavid Howells    Note that protocol values should be standardized in order to
278607ca46eSDavid Howells    avoid conflicts.
279607ca46eSDavid Howells  */
280607ca46eSDavid Howells 
281607ca46eSDavid Howells #define RTPROT_GATED		8	/* Apparently, GateD */
282607ca46eSDavid Howells #define RTPROT_RA		9	/* RDISC/ND router advertisements */
283607ca46eSDavid Howells #define RTPROT_MRT		10	/* Merit MRT */
284607ca46eSDavid Howells #define RTPROT_ZEBRA		11	/* Zebra */
285607ca46eSDavid Howells #define RTPROT_BIRD		12	/* BIRD */
286607ca46eSDavid Howells #define RTPROT_DNROUTED		13	/* DECnet routing daemon */
287607ca46eSDavid Howells #define RTPROT_XORP		14	/* XORP */
288607ca46eSDavid Howells #define RTPROT_NTK		15	/* Netsukuku */
289607ca46eSDavid Howells #define RTPROT_DHCP		16	/* DHCP client */
2909a68ac72SNicolas Dichtel #define RTPROT_MROUTED		17	/* Multicast daemon */
29179a28dddSAlexandre Cassen #define RTPROT_KEEPALIVED	18	/* Keepalived daemon */
292be955b29SDave Taht #define RTPROT_BABEL		42	/* Babel daemon */
29335aada99SDonald Sharp #define RTPROT_BGP		186	/* BGP Routes */
29435aada99SDonald Sharp #define RTPROT_ISIS		187	/* ISIS Routes */
29535aada99SDonald Sharp #define RTPROT_OSPF		188	/* OSPF Routes */
29635aada99SDonald Sharp #define RTPROT_RIP		189	/* RIP Routes */
29735aada99SDonald Sharp #define RTPROT_EIGRP		192	/* EIGRP Routes */
298607ca46eSDavid Howells 
299607ca46eSDavid Howells /* rtm_scope
300607ca46eSDavid Howells 
301607ca46eSDavid Howells    Really it is not scope, but sort of distance to the destination.
302607ca46eSDavid Howells    NOWHERE are reserved for not existing destinations, HOST is our
303607ca46eSDavid Howells    local addresses, LINK are destinations, located on directly attached
304607ca46eSDavid Howells    link and UNIVERSE is everywhere in the Universe.
305607ca46eSDavid Howells 
306607ca46eSDavid Howells    Intermediate values are also possible f.e. interior routes
307607ca46eSDavid Howells    could be assigned a value between UNIVERSE and LINK.
308607ca46eSDavid Howells */
309607ca46eSDavid Howells 
310607ca46eSDavid Howells enum rt_scope_t {
311607ca46eSDavid Howells 	RT_SCOPE_UNIVERSE=0,
312607ca46eSDavid Howells /* User defined values  */
313607ca46eSDavid Howells 	RT_SCOPE_SITE=200,
314607ca46eSDavid Howells 	RT_SCOPE_LINK=253,
315607ca46eSDavid Howells 	RT_SCOPE_HOST=254,
316607ca46eSDavid Howells 	RT_SCOPE_NOWHERE=255
317607ca46eSDavid Howells };
318607ca46eSDavid Howells 
319607ca46eSDavid Howells /* rtm_flags */
320607ca46eSDavid Howells 
321607ca46eSDavid Howells #define RTM_F_NOTIFY		0x100	/* Notify user of route change	*/
322607ca46eSDavid Howells #define RTM_F_CLONED		0x200	/* This route is cloned		*/
323607ca46eSDavid Howells #define RTM_F_EQUALIZE		0x400	/* Multipath equalizer: NI	*/
324607ca46eSDavid Howells #define RTM_F_PREFIX		0x800	/* Prefix addresses		*/
325c36ba660SDavid Ahern #define RTM_F_LOOKUP_TABLE	0x1000	/* set rtm_table to FIB lookup result */
3260be1b305SRoopa Prabhu #define RTM_F_FIB_MATCH	        0x2000	/* return full fib lookup match */
32790b93f1bSIdo Schimmel #define RTM_F_OFFLOAD		0x4000	/* route is offloaded */
32890b93f1bSIdo Schimmel #define RTM_F_TRAP		0x8000	/* route is trapping packets */
32949fc2513SAmit Cohen #define RTM_F_OFFLOAD_FAILED	0x20000000 /* route offload failed, this value
33049fc2513SAmit Cohen 					    * is chosen to avoid conflicts with
33149fc2513SAmit Cohen 					    * other flags defined in
33249fc2513SAmit Cohen 					    * include/uapi/linux/ipv6_route.h
33349fc2513SAmit Cohen 					    */
334607ca46eSDavid Howells 
335607ca46eSDavid Howells /* Reserved table identifiers */
336607ca46eSDavid Howells 
337607ca46eSDavid Howells enum rt_class_t {
338607ca46eSDavid Howells 	RT_TABLE_UNSPEC=0,
339607ca46eSDavid Howells /* User defined values */
340607ca46eSDavid Howells 	RT_TABLE_COMPAT=252,
341607ca46eSDavid Howells 	RT_TABLE_DEFAULT=253,
342607ca46eSDavid Howells 	RT_TABLE_MAIN=254,
343607ca46eSDavid Howells 	RT_TABLE_LOCAL=255,
344607ca46eSDavid Howells 	RT_TABLE_MAX=0xFFFFFFFF
345607ca46eSDavid Howells };
346607ca46eSDavid Howells 
347607ca46eSDavid Howells 
348607ca46eSDavid Howells /* Routing message attributes */
349607ca46eSDavid Howells 
350607ca46eSDavid Howells enum rtattr_type_t {
351607ca46eSDavid Howells 	RTA_UNSPEC,
352607ca46eSDavid Howells 	RTA_DST,
353607ca46eSDavid Howells 	RTA_SRC,
354607ca46eSDavid Howells 	RTA_IIF,
355607ca46eSDavid Howells 	RTA_OIF,
356607ca46eSDavid Howells 	RTA_GATEWAY,
357607ca46eSDavid Howells 	RTA_PRIORITY,
358607ca46eSDavid Howells 	RTA_PREFSRC,
359607ca46eSDavid Howells 	RTA_METRICS,
360607ca46eSDavid Howells 	RTA_MULTIPATH,
361607ca46eSDavid Howells 	RTA_PROTOINFO, /* no longer used */
362607ca46eSDavid Howells 	RTA_FLOW,
363607ca46eSDavid Howells 	RTA_CACHEINFO,
364607ca46eSDavid Howells 	RTA_SESSION, /* no longer used */
365607ca46eSDavid Howells 	RTA_MP_ALGO, /* no longer used */
366607ca46eSDavid Howells 	RTA_TABLE,
367607ca46eSDavid Howells 	RTA_MARK,
368adfa85e4SNicolas Dichtel 	RTA_MFC_STATS,
36903c05665SEric W. Biederman 	RTA_VIA,
37003c05665SEric W. Biederman 	RTA_NEWDST,
371c78ba6d6SLubomir Rintel 	RTA_PREF,
372a0d9a860SRoopa Prabhu 	RTA_ENCAP_TYPE,
373a0d9a860SRoopa Prabhu 	RTA_ENCAP,
37432bc201eSXin Long 	RTA_EXPIRES,
375a9a08042SNicolas Dichtel 	RTA_PAD,
376622ec2c9SLorenzo Colitti 	RTA_UID,
3775b441ac8SRobert Shearman 	RTA_TTL_PROPAGATE,
378404eb77eSRoopa Prabhu 	RTA_IP_PROTO,
379404eb77eSRoopa Prabhu 	RTA_SPORT,
380404eb77eSRoopa Prabhu 	RTA_DPORT,
38165ee00a9SDavid Ahern 	RTA_NH_ID,
382607ca46eSDavid Howells 	__RTA_MAX
383607ca46eSDavid Howells };
384607ca46eSDavid Howells 
385607ca46eSDavid Howells #define RTA_MAX (__RTA_MAX - 1)
386607ca46eSDavid Howells 
387607ca46eSDavid Howells #define RTM_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
388607ca46eSDavid Howells #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
389607ca46eSDavid Howells 
390607ca46eSDavid Howells /* RTM_MULTIPATH --- array of struct rtnexthop.
391607ca46eSDavid Howells  *
392607ca46eSDavid Howells  * "struct rtnexthop" describes all necessary nexthop information,
393607ca46eSDavid Howells  * i.e. parameters of path to a destination via this nexthop.
394607ca46eSDavid Howells  *
395607ca46eSDavid Howells  * At the moment it is impossible to set different prefsrc, mtu, window
396607ca46eSDavid Howells  * and rtt for different paths from multipath.
397607ca46eSDavid Howells  */
398607ca46eSDavid Howells 
399607ca46eSDavid Howells struct rtnexthop {
400607ca46eSDavid Howells 	unsigned short		rtnh_len;
401607ca46eSDavid Howells 	unsigned char		rtnh_flags;
402607ca46eSDavid Howells 	unsigned char		rtnh_hops;
403607ca46eSDavid Howells 	int			rtnh_ifindex;
404607ca46eSDavid Howells };
405607ca46eSDavid Howells 
406607ca46eSDavid Howells /* rtnh_flags */
407607ca46eSDavid Howells 
408607ca46eSDavid Howells #define RTNH_F_DEAD		1	/* Nexthop is dead (used by multipath)	*/
409607ca46eSDavid Howells #define RTNH_F_PERVASIVE	2	/* Do recursive gateway lookup	*/
410607ca46eSDavid Howells #define RTNH_F_ONLINK		4	/* Gateway is forced on link	*/
411968a83f8SIdo Schimmel #define RTNH_F_OFFLOAD		8	/* Nexthop is offloaded */
4128a3d0316SAndy Gospodarek #define RTNH_F_LINKDOWN		16	/* carrier-down on nexthop */
4131708ebc9SNikolay Aleksandrov #define RTNH_F_UNRESOLVED	32	/* The entry is unresolved (ipmr) */
414968a83f8SIdo Schimmel #define RTNH_F_TRAP		64	/* Nexthop is trapping packets */
4158a3d0316SAndy Gospodarek 
416968a83f8SIdo Schimmel #define RTNH_COMPARE_MASK	(RTNH_F_DEAD | RTNH_F_LINKDOWN | \
417968a83f8SIdo Schimmel 				 RTNH_F_OFFLOAD | RTNH_F_TRAP)
418607ca46eSDavid Howells 
419607ca46eSDavid Howells /* Macros to handle hexthops */
420607ca46eSDavid Howells 
421607ca46eSDavid Howells #define RTNH_ALIGNTO	4
422607ca46eSDavid Howells #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) )
423607ca46eSDavid Howells #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
424607ca46eSDavid Howells 			   ((int)(rtnh)->rtnh_len) <= (len))
425607ca46eSDavid Howells #define RTNH_NEXT(rtnh)	((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
426607ca46eSDavid Howells #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len))
427607ca46eSDavid Howells #define RTNH_SPACE(len)	RTNH_ALIGN(RTNH_LENGTH(len))
428607ca46eSDavid Howells #define RTNH_DATA(rtnh)   ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
429607ca46eSDavid Howells 
43003c05665SEric W. Biederman /* RTA_VIA */
43103c05665SEric W. Biederman struct rtvia {
43203c05665SEric W. Biederman 	__kernel_sa_family_t	rtvia_family;
43303c05665SEric W. Biederman 	__u8			rtvia_addr[0];
43403c05665SEric W. Biederman };
43503c05665SEric W. Biederman 
436607ca46eSDavid Howells /* RTM_CACHEINFO */
437607ca46eSDavid Howells 
438607ca46eSDavid Howells struct rta_cacheinfo {
439607ca46eSDavid Howells 	__u32	rta_clntref;
440607ca46eSDavid Howells 	__u32	rta_lastuse;
441607ca46eSDavid Howells 	__s32	rta_expires;
442607ca46eSDavid Howells 	__u32	rta_error;
443607ca46eSDavid Howells 	__u32	rta_used;
444607ca46eSDavid Howells 
445607ca46eSDavid Howells #define RTNETLINK_HAVE_PEERINFO 1
446607ca46eSDavid Howells 	__u32	rta_id;
447607ca46eSDavid Howells 	__u32	rta_ts;
448607ca46eSDavid Howells 	__u32	rta_tsage;
449607ca46eSDavid Howells };
450607ca46eSDavid Howells 
451607ca46eSDavid Howells /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
452607ca46eSDavid Howells 
453607ca46eSDavid Howells enum {
454607ca46eSDavid Howells 	RTAX_UNSPEC,
455607ca46eSDavid Howells #define RTAX_UNSPEC RTAX_UNSPEC
456607ca46eSDavid Howells 	RTAX_LOCK,
457607ca46eSDavid Howells #define RTAX_LOCK RTAX_LOCK
458607ca46eSDavid Howells 	RTAX_MTU,
459607ca46eSDavid Howells #define RTAX_MTU RTAX_MTU
460607ca46eSDavid Howells 	RTAX_WINDOW,
461607ca46eSDavid Howells #define RTAX_WINDOW RTAX_WINDOW
462607ca46eSDavid Howells 	RTAX_RTT,
463607ca46eSDavid Howells #define RTAX_RTT RTAX_RTT
464607ca46eSDavid Howells 	RTAX_RTTVAR,
465607ca46eSDavid Howells #define RTAX_RTTVAR RTAX_RTTVAR
466607ca46eSDavid Howells 	RTAX_SSTHRESH,
467607ca46eSDavid Howells #define RTAX_SSTHRESH RTAX_SSTHRESH
468607ca46eSDavid Howells 	RTAX_CWND,
469607ca46eSDavid Howells #define RTAX_CWND RTAX_CWND
470607ca46eSDavid Howells 	RTAX_ADVMSS,
471607ca46eSDavid Howells #define RTAX_ADVMSS RTAX_ADVMSS
472607ca46eSDavid Howells 	RTAX_REORDERING,
473607ca46eSDavid Howells #define RTAX_REORDERING RTAX_REORDERING
474607ca46eSDavid Howells 	RTAX_HOPLIMIT,
475607ca46eSDavid Howells #define RTAX_HOPLIMIT RTAX_HOPLIMIT
476607ca46eSDavid Howells 	RTAX_INITCWND,
477607ca46eSDavid Howells #define RTAX_INITCWND RTAX_INITCWND
478607ca46eSDavid Howells 	RTAX_FEATURES,
479607ca46eSDavid Howells #define RTAX_FEATURES RTAX_FEATURES
480607ca46eSDavid Howells 	RTAX_RTO_MIN,
481607ca46eSDavid Howells #define RTAX_RTO_MIN RTAX_RTO_MIN
482607ca46eSDavid Howells 	RTAX_INITRWND,
483607ca46eSDavid Howells #define RTAX_INITRWND RTAX_INITRWND
484bcefe17cSCong Wang 	RTAX_QUICKACK,
485bcefe17cSCong Wang #define RTAX_QUICKACK RTAX_QUICKACK
486ea697639SDaniel Borkmann 	RTAX_CC_ALGO,
487ea697639SDaniel Borkmann #define RTAX_CC_ALGO RTAX_CC_ALGO
48871c02379SChristoph Paasch 	RTAX_FASTOPEN_NO_COOKIE,
48971c02379SChristoph Paasch #define RTAX_FASTOPEN_NO_COOKIE RTAX_FASTOPEN_NO_COOKIE
490607ca46eSDavid Howells 	__RTAX_MAX
491607ca46eSDavid Howells };
492607ca46eSDavid Howells 
493607ca46eSDavid Howells #define RTAX_MAX (__RTAX_MAX - 1)
494607ca46eSDavid Howells 
495b8d3e416SDaniel Borkmann #define RTAX_FEATURE_ECN	(1 << 0)
496b8d3e416SDaniel Borkmann #define RTAX_FEATURE_SACK	(1 << 1)
497b8d3e416SDaniel Borkmann #define RTAX_FEATURE_TIMESTAMP	(1 << 2)
498b8d3e416SDaniel Borkmann #define RTAX_FEATURE_ALLFRAG	(1 << 3)
499b8d3e416SDaniel Borkmann 
500b8d3e416SDaniel Borkmann #define RTAX_FEATURE_MASK	(RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | \
501b8d3e416SDaniel Borkmann 				 RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG)
502607ca46eSDavid Howells 
503607ca46eSDavid Howells struct rta_session {
504607ca46eSDavid Howells 	__u8	proto;
505607ca46eSDavid Howells 	__u8	pad1;
506607ca46eSDavid Howells 	__u16	pad2;
507607ca46eSDavid Howells 
508607ca46eSDavid Howells 	union {
509607ca46eSDavid Howells 		struct {
510607ca46eSDavid Howells 			__u16	sport;
511607ca46eSDavid Howells 			__u16	dport;
512607ca46eSDavid Howells 		} ports;
513607ca46eSDavid Howells 
514607ca46eSDavid Howells 		struct {
515607ca46eSDavid Howells 			__u8	type;
516607ca46eSDavid Howells 			__u8	code;
517607ca46eSDavid Howells 			__u16	ident;
518607ca46eSDavid Howells 		} icmpt;
519607ca46eSDavid Howells 
520607ca46eSDavid Howells 		__u32		spi;
521607ca46eSDavid Howells 	} u;
522607ca46eSDavid Howells };
523607ca46eSDavid Howells 
524adfa85e4SNicolas Dichtel struct rta_mfc_stats {
525adfa85e4SNicolas Dichtel 	__u64	mfcs_packets;
526adfa85e4SNicolas Dichtel 	__u64	mfcs_bytes;
527adfa85e4SNicolas Dichtel 	__u64	mfcs_wrong_if;
528adfa85e4SNicolas Dichtel };
529adfa85e4SNicolas Dichtel 
530607ca46eSDavid Howells /****
531607ca46eSDavid Howells  *		General form of address family dependent message.
532607ca46eSDavid Howells  ****/
533607ca46eSDavid Howells 
534607ca46eSDavid Howells struct rtgenmsg {
535607ca46eSDavid Howells 	unsigned char		rtgen_family;
536607ca46eSDavid Howells };
537607ca46eSDavid Howells 
538607ca46eSDavid Howells /*****************************************************************
539607ca46eSDavid Howells  *		Link layer specific messages.
540607ca46eSDavid Howells  ****/
541607ca46eSDavid Howells 
542607ca46eSDavid Howells /* struct ifinfomsg
543607ca46eSDavid Howells  * passes link level specific information, not dependent
544607ca46eSDavid Howells  * on network protocol.
545607ca46eSDavid Howells  */
546607ca46eSDavid Howells 
547607ca46eSDavid Howells struct ifinfomsg {
548607ca46eSDavid Howells 	unsigned char	ifi_family;
549607ca46eSDavid Howells 	unsigned char	__ifi_pad;
550607ca46eSDavid Howells 	unsigned short	ifi_type;		/* ARPHRD_* */
551607ca46eSDavid Howells 	int		ifi_index;		/* Link index	*/
552607ca46eSDavid Howells 	unsigned	ifi_flags;		/* IFF_* flags	*/
553607ca46eSDavid Howells 	unsigned	ifi_change;		/* IFF_* change mask */
554607ca46eSDavid Howells };
555607ca46eSDavid Howells 
556607ca46eSDavid Howells /********************************************************************
557607ca46eSDavid Howells  *		prefix information
558607ca46eSDavid Howells  ****/
559607ca46eSDavid Howells 
560607ca46eSDavid Howells struct prefixmsg {
561607ca46eSDavid Howells 	unsigned char	prefix_family;
562607ca46eSDavid Howells 	unsigned char	prefix_pad1;
563607ca46eSDavid Howells 	unsigned short	prefix_pad2;
564607ca46eSDavid Howells 	int		prefix_ifindex;
565607ca46eSDavid Howells 	unsigned char	prefix_type;
566607ca46eSDavid Howells 	unsigned char	prefix_len;
567607ca46eSDavid Howells 	unsigned char	prefix_flags;
568607ca46eSDavid Howells 	unsigned char	prefix_pad3;
569607ca46eSDavid Howells };
570607ca46eSDavid Howells 
571607ca46eSDavid Howells enum
572607ca46eSDavid Howells {
573607ca46eSDavid Howells 	PREFIX_UNSPEC,
574607ca46eSDavid Howells 	PREFIX_ADDRESS,
575607ca46eSDavid Howells 	PREFIX_CACHEINFO,
576607ca46eSDavid Howells 	__PREFIX_MAX
577607ca46eSDavid Howells };
578607ca46eSDavid Howells 
579607ca46eSDavid Howells #define PREFIX_MAX	(__PREFIX_MAX - 1)
580607ca46eSDavid Howells 
581607ca46eSDavid Howells struct prefix_cacheinfo {
582607ca46eSDavid Howells 	__u32	preferred_time;
583607ca46eSDavid Howells 	__u32	valid_time;
584607ca46eSDavid Howells };
585607ca46eSDavid Howells 
586607ca46eSDavid Howells 
587607ca46eSDavid Howells /*****************************************************************
588607ca46eSDavid Howells  *		Traffic control messages.
589607ca46eSDavid Howells  ****/
590607ca46eSDavid Howells 
591607ca46eSDavid Howells struct tcmsg {
592607ca46eSDavid Howells 	unsigned char	tcm_family;
593607ca46eSDavid Howells 	unsigned char	tcm__pad1;
594607ca46eSDavid Howells 	unsigned short	tcm__pad2;
595607ca46eSDavid Howells 	int		tcm_ifindex;
596607ca46eSDavid Howells 	__u32		tcm_handle;
597607ca46eSDavid Howells 	__u32		tcm_parent;
5987960d1daSJiri Pirko /* tcm_block_index is used instead of tcm_parent
5997960d1daSJiri Pirko  * in case tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK
6007960d1daSJiri Pirko  */
6017960d1daSJiri Pirko #define tcm_block_index tcm_parent
602607ca46eSDavid Howells 	__u32		tcm_info;
603607ca46eSDavid Howells };
604607ca46eSDavid Howells 
6057960d1daSJiri Pirko /* For manipulation of filters in shared block, tcm_ifindex is set to
6067960d1daSJiri Pirko  * TCM_IFINDEX_MAGIC_BLOCK, and tcm_parent is aliased to tcm_block_index
6077960d1daSJiri Pirko  * which is the block index.
6087960d1daSJiri Pirko  */
6097960d1daSJiri Pirko #define TCM_IFINDEX_MAGIC_BLOCK (0xFFFFFFFFU)
6107960d1daSJiri Pirko 
611607ca46eSDavid Howells enum {
612607ca46eSDavid Howells 	TCA_UNSPEC,
613607ca46eSDavid Howells 	TCA_KIND,
614607ca46eSDavid Howells 	TCA_OPTIONS,
615607ca46eSDavid Howells 	TCA_STATS,
616607ca46eSDavid Howells 	TCA_XSTATS,
617607ca46eSDavid Howells 	TCA_RATE,
618607ca46eSDavid Howells 	TCA_FCNT,
619607ca46eSDavid Howells 	TCA_STATS2,
620607ca46eSDavid Howells 	TCA_STAB,
6219854518eSNicolas Dichtel 	TCA_PAD,
62249b49971SJiri Kosina 	TCA_DUMP_INVISIBLE,
6235bc17018SJiri Pirko 	TCA_CHAIN,
6247a4fa291SYuval Mintz 	TCA_HW_OFFLOAD,
625d47a6b0eSJiri Pirko 	TCA_INGRESS_BLOCK,
626d47a6b0eSJiri Pirko 	TCA_EGRESS_BLOCK,
627f8ab1807SVlad Buslov 	TCA_DUMP_FLAGS,
628607ca46eSDavid Howells 	__TCA_MAX
629607ca46eSDavid Howells };
630607ca46eSDavid Howells 
631607ca46eSDavid Howells #define TCA_MAX (__TCA_MAX - 1)
632607ca46eSDavid Howells 
633f8ab1807SVlad Buslov #define TCA_DUMP_FLAGS_TERSE (1 << 0) /* Means that in dump user gets only basic
634f8ab1807SVlad Buslov 				       * data necessary to identify the objects
635f8ab1807SVlad Buslov 				       * (handle, cookie, etc.) and stats.
636f8ab1807SVlad Buslov 				       */
637f8ab1807SVlad Buslov 
638607ca46eSDavid Howells #define TCA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
639607ca46eSDavid Howells #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
640607ca46eSDavid Howells 
641607ca46eSDavid Howells /********************************************************************
642607ca46eSDavid Howells  *		Neighbor Discovery userland options
643607ca46eSDavid Howells  ****/
644607ca46eSDavid Howells 
645607ca46eSDavid Howells struct nduseroptmsg {
646607ca46eSDavid Howells 	unsigned char	nduseropt_family;
647607ca46eSDavid Howells 	unsigned char	nduseropt_pad1;
648607ca46eSDavid Howells 	unsigned short	nduseropt_opts_len;	/* Total length of options */
649607ca46eSDavid Howells 	int		nduseropt_ifindex;
650607ca46eSDavid Howells 	__u8		nduseropt_icmp_type;
651607ca46eSDavid Howells 	__u8		nduseropt_icmp_code;
652607ca46eSDavid Howells 	unsigned short	nduseropt_pad2;
653607ca46eSDavid Howells 	unsigned int	nduseropt_pad3;
654607ca46eSDavid Howells 	/* Followed by one or more ND options */
655607ca46eSDavid Howells };
656607ca46eSDavid Howells 
657607ca46eSDavid Howells enum {
658607ca46eSDavid Howells 	NDUSEROPT_UNSPEC,
659607ca46eSDavid Howells 	NDUSEROPT_SRCADDR,
660607ca46eSDavid Howells 	__NDUSEROPT_MAX
661607ca46eSDavid Howells };
662607ca46eSDavid Howells 
663607ca46eSDavid Howells #define NDUSEROPT_MAX	(__NDUSEROPT_MAX - 1)
664607ca46eSDavid Howells 
665607ca46eSDavid Howells #ifndef __KERNEL__
666607ca46eSDavid Howells /* RTnetlink multicast groups - backwards compatibility for userspace */
667607ca46eSDavid Howells #define RTMGRP_LINK		1
668607ca46eSDavid Howells #define RTMGRP_NOTIFY		2
669607ca46eSDavid Howells #define RTMGRP_NEIGH		4
670607ca46eSDavid Howells #define RTMGRP_TC		8
671607ca46eSDavid Howells 
672607ca46eSDavid Howells #define RTMGRP_IPV4_IFADDR	0x10
673607ca46eSDavid Howells #define RTMGRP_IPV4_MROUTE	0x20
674607ca46eSDavid Howells #define RTMGRP_IPV4_ROUTE	0x40
675607ca46eSDavid Howells #define RTMGRP_IPV4_RULE	0x80
676607ca46eSDavid Howells 
677607ca46eSDavid Howells #define RTMGRP_IPV6_IFADDR	0x100
678607ca46eSDavid Howells #define RTMGRP_IPV6_MROUTE	0x200
679607ca46eSDavid Howells #define RTMGRP_IPV6_ROUTE	0x400
680607ca46eSDavid Howells #define RTMGRP_IPV6_IFINFO	0x800
681607ca46eSDavid Howells 
682607ca46eSDavid Howells #define RTMGRP_DECnet_IFADDR    0x1000
683607ca46eSDavid Howells #define RTMGRP_DECnet_ROUTE     0x4000
684607ca46eSDavid Howells 
685607ca46eSDavid Howells #define RTMGRP_IPV6_PREFIX	0x20000
686607ca46eSDavid Howells #endif
687607ca46eSDavid Howells 
688607ca46eSDavid Howells /* RTnetlink multicast groups */
689607ca46eSDavid Howells enum rtnetlink_groups {
690607ca46eSDavid Howells 	RTNLGRP_NONE,
691607ca46eSDavid Howells #define RTNLGRP_NONE		RTNLGRP_NONE
692607ca46eSDavid Howells 	RTNLGRP_LINK,
693607ca46eSDavid Howells #define RTNLGRP_LINK		RTNLGRP_LINK
694607ca46eSDavid Howells 	RTNLGRP_NOTIFY,
695607ca46eSDavid Howells #define RTNLGRP_NOTIFY		RTNLGRP_NOTIFY
696607ca46eSDavid Howells 	RTNLGRP_NEIGH,
697607ca46eSDavid Howells #define RTNLGRP_NEIGH		RTNLGRP_NEIGH
698607ca46eSDavid Howells 	RTNLGRP_TC,
699607ca46eSDavid Howells #define RTNLGRP_TC		RTNLGRP_TC
700607ca46eSDavid Howells 	RTNLGRP_IPV4_IFADDR,
701607ca46eSDavid Howells #define RTNLGRP_IPV4_IFADDR	RTNLGRP_IPV4_IFADDR
702607ca46eSDavid Howells 	RTNLGRP_IPV4_MROUTE,
703607ca46eSDavid Howells #define	RTNLGRP_IPV4_MROUTE	RTNLGRP_IPV4_MROUTE
704607ca46eSDavid Howells 	RTNLGRP_IPV4_ROUTE,
705607ca46eSDavid Howells #define RTNLGRP_IPV4_ROUTE	RTNLGRP_IPV4_ROUTE
706607ca46eSDavid Howells 	RTNLGRP_IPV4_RULE,
707607ca46eSDavid Howells #define RTNLGRP_IPV4_RULE	RTNLGRP_IPV4_RULE
708607ca46eSDavid Howells 	RTNLGRP_IPV6_IFADDR,
709607ca46eSDavid Howells #define RTNLGRP_IPV6_IFADDR	RTNLGRP_IPV6_IFADDR
710607ca46eSDavid Howells 	RTNLGRP_IPV6_MROUTE,
711607ca46eSDavid Howells #define RTNLGRP_IPV6_MROUTE	RTNLGRP_IPV6_MROUTE
712607ca46eSDavid Howells 	RTNLGRP_IPV6_ROUTE,
713607ca46eSDavid Howells #define RTNLGRP_IPV6_ROUTE	RTNLGRP_IPV6_ROUTE
714607ca46eSDavid Howells 	RTNLGRP_IPV6_IFINFO,
715607ca46eSDavid Howells #define RTNLGRP_IPV6_IFINFO	RTNLGRP_IPV6_IFINFO
716607ca46eSDavid Howells 	RTNLGRP_DECnet_IFADDR,
717607ca46eSDavid Howells #define RTNLGRP_DECnet_IFADDR	RTNLGRP_DECnet_IFADDR
718607ca46eSDavid Howells 	RTNLGRP_NOP2,
719607ca46eSDavid Howells 	RTNLGRP_DECnet_ROUTE,
720607ca46eSDavid Howells #define RTNLGRP_DECnet_ROUTE	RTNLGRP_DECnet_ROUTE
721607ca46eSDavid Howells 	RTNLGRP_DECnet_RULE,
722607ca46eSDavid Howells #define RTNLGRP_DECnet_RULE	RTNLGRP_DECnet_RULE
723607ca46eSDavid Howells 	RTNLGRP_NOP4,
724607ca46eSDavid Howells 	RTNLGRP_IPV6_PREFIX,
725607ca46eSDavid Howells #define RTNLGRP_IPV6_PREFIX	RTNLGRP_IPV6_PREFIX
726607ca46eSDavid Howells 	RTNLGRP_IPV6_RULE,
727607ca46eSDavid Howells #define RTNLGRP_IPV6_RULE	RTNLGRP_IPV6_RULE
728607ca46eSDavid Howells 	RTNLGRP_ND_USEROPT,
729607ca46eSDavid Howells #define RTNLGRP_ND_USEROPT	RTNLGRP_ND_USEROPT
730607ca46eSDavid Howells 	RTNLGRP_PHONET_IFADDR,
731607ca46eSDavid Howells #define RTNLGRP_PHONET_IFADDR	RTNLGRP_PHONET_IFADDR
732607ca46eSDavid Howells 	RTNLGRP_PHONET_ROUTE,
733607ca46eSDavid Howells #define RTNLGRP_PHONET_ROUTE	RTNLGRP_PHONET_ROUTE
734607ca46eSDavid Howells 	RTNLGRP_DCB,
735607ca46eSDavid Howells #define RTNLGRP_DCB		RTNLGRP_DCB
736edc9e748SNicolas Dichtel 	RTNLGRP_IPV4_NETCONF,
737edc9e748SNicolas Dichtel #define RTNLGRP_IPV4_NETCONF	RTNLGRP_IPV4_NETCONF
738f3a1bfb1SNicolas Dichtel 	RTNLGRP_IPV6_NETCONF,
739f3a1bfb1SNicolas Dichtel #define RTNLGRP_IPV6_NETCONF	RTNLGRP_IPV6_NETCONF
74037a393bcSCong Wang 	RTNLGRP_MDB,
74137a393bcSCong Wang #define RTNLGRP_MDB		RTNLGRP_MDB
7428de147dcSEric W. Biederman 	RTNLGRP_MPLS_ROUTE,
7438de147dcSEric W. Biederman #define RTNLGRP_MPLS_ROUTE	RTNLGRP_MPLS_ROUTE
7449a963454SNicolas Dichtel 	RTNLGRP_NSID,
7459a963454SNicolas Dichtel #define RTNLGRP_NSID		RTNLGRP_NSID
74624045a03SDavid Ahern 	RTNLGRP_MPLS_NETCONF,
74724045a03SDavid Ahern #define RTNLGRP_MPLS_NETCONF	RTNLGRP_MPLS_NETCONF
7485f729eaaSJulien Gomes 	RTNLGRP_IPV4_MROUTE_R,
7495f729eaaSJulien Gomes #define RTNLGRP_IPV4_MROUTE_R	RTNLGRP_IPV4_MROUTE_R
7505f729eaaSJulien Gomes 	RTNLGRP_IPV6_MROUTE_R,
7515f729eaaSJulien Gomes #define RTNLGRP_IPV6_MROUTE_R	RTNLGRP_IPV6_MROUTE_R
75265ee00a9SDavid Ahern 	RTNLGRP_NEXTHOP,
75365ee00a9SDavid Ahern #define RTNLGRP_NEXTHOP		RTNLGRP_NEXTHOP
754cf5bddb9SNikolay Aleksandrov 	RTNLGRP_BRVLAN,
755cf5bddb9SNikolay Aleksandrov #define RTNLGRP_BRVLAN		RTNLGRP_BRVLAN
756607ca46eSDavid Howells 	__RTNLGRP_MAX
757607ca46eSDavid Howells };
758607ca46eSDavid Howells #define RTNLGRP_MAX	(__RTNLGRP_MAX - 1)
759607ca46eSDavid Howells 
760607ca46eSDavid Howells /* TC action piece */
761607ca46eSDavid Howells struct tcamsg {
762607ca46eSDavid Howells 	unsigned char	tca_family;
763607ca46eSDavid Howells 	unsigned char	tca__pad1;
764607ca46eSDavid Howells 	unsigned short	tca__pad2;
765607ca46eSDavid Howells };
76690825b23SJamal Hadi Salim 
76790825b23SJamal Hadi Salim enum {
76890825b23SJamal Hadi Salim 	TCA_ROOT_UNSPEC,
76990825b23SJamal Hadi Salim 	TCA_ROOT_TAB,
77090825b23SJamal Hadi Salim #define TCA_ACT_TAB TCA_ROOT_TAB
77190825b23SJamal Hadi Salim #define TCAA_MAX TCA_ROOT_TAB
77290825b23SJamal Hadi Salim 	TCA_ROOT_FLAGS,
77390825b23SJamal Hadi Salim 	TCA_ROOT_COUNT,
774e62e484dSJamal Hadi Salim 	TCA_ROOT_TIME_DELTA, /* in msecs */
77590825b23SJamal Hadi Salim 	__TCA_ROOT_MAX,
77690825b23SJamal Hadi Salim #define	TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
77790825b23SJamal Hadi Salim };
77890825b23SJamal Hadi Salim 
779607ca46eSDavid Howells #define TA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
780607ca46eSDavid Howells #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
78190825b23SJamal Hadi Salim /* tcamsg flags stored in attribute TCA_ROOT_FLAGS
78290825b23SJamal Hadi Salim  *
783f460019bSVlad Buslov  * TCA_ACT_FLAG_LARGE_DUMP_ON user->kernel to request for larger than
784f460019bSVlad Buslov  * TCA_ACT_MAX_PRIO actions in a dump. All dump responses will contain the
785f460019bSVlad Buslov  * number of actions being dumped stored in for user app's consumption in
786f460019bSVlad Buslov  * TCA_ROOT_COUNT
78790825b23SJamal Hadi Salim  *
788f460019bSVlad Buslov  * TCA_ACT_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
78994f44f28SVlad Buslov  * includes essential action info (kind, index, etc.)
79094f44f28SVlad Buslov  *
79190825b23SJamal Hadi Salim  */
79290825b23SJamal Hadi Salim #define TCA_FLAG_LARGE_DUMP_ON		(1 << 0)
793f460019bSVlad Buslov #define TCA_ACT_FLAG_LARGE_DUMP_ON	TCA_FLAG_LARGE_DUMP_ON
794f460019bSVlad Buslov #define TCA_ACT_FLAG_TERSE_DUMP		(1 << 1)
795607ca46eSDavid Howells 
796607ca46eSDavid Howells /* New extended info filters for IFLA_EXT_MASK */
797607ca46eSDavid Howells #define RTEXT_FILTER_VF		(1 << 0)
7986cbdceebSVlad Yasevich #define RTEXT_FILTER_BRVLAN	(1 << 1)
79935a27ceeSRoopa Prabhu #define RTEXT_FILTER_BRVLAN_COMPRESSED	(1 << 2)
800d5566fd7SSowmini Varadhan #define	RTEXT_FILTER_SKIP_STATS	(1 << 3)
80136a8e8e2SHoratiu Vultur #define RTEXT_FILTER_MRP	(1 << 4)
8022be665c3SHenrik Bjoernlund #define RTEXT_FILTER_CFM_CONFIG	(1 << 5)
803e77824d8SHenrik Bjoernlund #define RTEXT_FILTER_CFM_STATUS	(1 << 6)
804607ca46eSDavid Howells 
805607ca46eSDavid Howells /* End of information exported to user level */
806607ca46eSDavid Howells 
807607ca46eSDavid Howells 
808607ca46eSDavid Howells 
809607ca46eSDavid Howells #endif /* _UAPI__LINUX_RTNETLINK_H */
810