xref: /openbmc/linux/include/uapi/linux/rtnetlink.h (revision 9a68ac72)
1607ca46eSDavid Howells #ifndef _UAPI__LINUX_RTNETLINK_H
2607ca46eSDavid Howells #define _UAPI__LINUX_RTNETLINK_H
3607ca46eSDavid Howells 
4607ca46eSDavid Howells #include <linux/types.h>
5607ca46eSDavid Howells #include <linux/netlink.h>
6607ca46eSDavid Howells #include <linux/if_link.h>
7607ca46eSDavid Howells #include <linux/if_addr.h>
8607ca46eSDavid Howells #include <linux/neighbour.h>
9607ca46eSDavid Howells 
10607ca46eSDavid Howells /* rtnetlink families. Values up to 127 are reserved for real address
11607ca46eSDavid Howells  * families, values above 128 may be used arbitrarily.
12607ca46eSDavid Howells  */
13607ca46eSDavid Howells #define RTNL_FAMILY_IPMR		128
14607ca46eSDavid Howells #define RTNL_FAMILY_IP6MR		129
15607ca46eSDavid Howells #define RTNL_FAMILY_MAX			129
16607ca46eSDavid Howells 
17607ca46eSDavid Howells /****
18607ca46eSDavid Howells  *		Routing/neighbour discovery messages.
19607ca46eSDavid Howells  ****/
20607ca46eSDavid Howells 
21607ca46eSDavid Howells /* Types of messages */
22607ca46eSDavid Howells 
23607ca46eSDavid Howells enum {
24607ca46eSDavid Howells 	RTM_BASE	= 16,
25607ca46eSDavid Howells #define RTM_BASE	RTM_BASE
26607ca46eSDavid Howells 
27607ca46eSDavid Howells 	RTM_NEWLINK	= 16,
28607ca46eSDavid Howells #define RTM_NEWLINK	RTM_NEWLINK
29607ca46eSDavid Howells 	RTM_DELLINK,
30607ca46eSDavid Howells #define RTM_DELLINK	RTM_DELLINK
31607ca46eSDavid Howells 	RTM_GETLINK,
32607ca46eSDavid Howells #define RTM_GETLINK	RTM_GETLINK
33607ca46eSDavid Howells 	RTM_SETLINK,
34607ca46eSDavid Howells #define RTM_SETLINK	RTM_SETLINK
35607ca46eSDavid Howells 
36607ca46eSDavid Howells 	RTM_NEWADDR	= 20,
37607ca46eSDavid Howells #define RTM_NEWADDR	RTM_NEWADDR
38607ca46eSDavid Howells 	RTM_DELADDR,
39607ca46eSDavid Howells #define RTM_DELADDR	RTM_DELADDR
40607ca46eSDavid Howells 	RTM_GETADDR,
41607ca46eSDavid Howells #define RTM_GETADDR	RTM_GETADDR
42607ca46eSDavid Howells 
43607ca46eSDavid Howells 	RTM_NEWROUTE	= 24,
44607ca46eSDavid Howells #define RTM_NEWROUTE	RTM_NEWROUTE
45607ca46eSDavid Howells 	RTM_DELROUTE,
46607ca46eSDavid Howells #define RTM_DELROUTE	RTM_DELROUTE
47607ca46eSDavid Howells 	RTM_GETROUTE,
48607ca46eSDavid Howells #define RTM_GETROUTE	RTM_GETROUTE
49607ca46eSDavid Howells 
50607ca46eSDavid Howells 	RTM_NEWNEIGH	= 28,
51607ca46eSDavid Howells #define RTM_NEWNEIGH	RTM_NEWNEIGH
52607ca46eSDavid Howells 	RTM_DELNEIGH,
53607ca46eSDavid Howells #define RTM_DELNEIGH	RTM_DELNEIGH
54607ca46eSDavid Howells 	RTM_GETNEIGH,
55607ca46eSDavid Howells #define RTM_GETNEIGH	RTM_GETNEIGH
56607ca46eSDavid Howells 
57607ca46eSDavid Howells 	RTM_NEWRULE	= 32,
58607ca46eSDavid Howells #define RTM_NEWRULE	RTM_NEWRULE
59607ca46eSDavid Howells 	RTM_DELRULE,
60607ca46eSDavid Howells #define RTM_DELRULE	RTM_DELRULE
61607ca46eSDavid Howells 	RTM_GETRULE,
62607ca46eSDavid Howells #define RTM_GETRULE	RTM_GETRULE
63607ca46eSDavid Howells 
64607ca46eSDavid Howells 	RTM_NEWQDISC	= 36,
65607ca46eSDavid Howells #define RTM_NEWQDISC	RTM_NEWQDISC
66607ca46eSDavid Howells 	RTM_DELQDISC,
67607ca46eSDavid Howells #define RTM_DELQDISC	RTM_DELQDISC
68607ca46eSDavid Howells 	RTM_GETQDISC,
69607ca46eSDavid Howells #define RTM_GETQDISC	RTM_GETQDISC
70607ca46eSDavid Howells 
71607ca46eSDavid Howells 	RTM_NEWTCLASS	= 40,
72607ca46eSDavid Howells #define RTM_NEWTCLASS	RTM_NEWTCLASS
73607ca46eSDavid Howells 	RTM_DELTCLASS,
74607ca46eSDavid Howells #define RTM_DELTCLASS	RTM_DELTCLASS
75607ca46eSDavid Howells 	RTM_GETTCLASS,
76607ca46eSDavid Howells #define RTM_GETTCLASS	RTM_GETTCLASS
77607ca46eSDavid Howells 
78607ca46eSDavid Howells 	RTM_NEWTFILTER	= 44,
79607ca46eSDavid Howells #define RTM_NEWTFILTER	RTM_NEWTFILTER
80607ca46eSDavid Howells 	RTM_DELTFILTER,
81607ca46eSDavid Howells #define RTM_DELTFILTER	RTM_DELTFILTER
82607ca46eSDavid Howells 	RTM_GETTFILTER,
83607ca46eSDavid Howells #define RTM_GETTFILTER	RTM_GETTFILTER
84607ca46eSDavid Howells 
85607ca46eSDavid Howells 	RTM_NEWACTION	= 48,
86607ca46eSDavid Howells #define RTM_NEWACTION   RTM_NEWACTION
87607ca46eSDavid Howells 	RTM_DELACTION,
88607ca46eSDavid Howells #define RTM_DELACTION   RTM_DELACTION
89607ca46eSDavid Howells 	RTM_GETACTION,
90607ca46eSDavid Howells #define RTM_GETACTION   RTM_GETACTION
91607ca46eSDavid Howells 
92607ca46eSDavid Howells 	RTM_NEWPREFIX	= 52,
93607ca46eSDavid Howells #define RTM_NEWPREFIX	RTM_NEWPREFIX
94607ca46eSDavid Howells 
95607ca46eSDavid Howells 	RTM_GETMULTICAST = 58,
96607ca46eSDavid Howells #define RTM_GETMULTICAST RTM_GETMULTICAST
97607ca46eSDavid Howells 
98607ca46eSDavid Howells 	RTM_GETANYCAST	= 62,
99607ca46eSDavid Howells #define RTM_GETANYCAST	RTM_GETANYCAST
100607ca46eSDavid Howells 
101607ca46eSDavid Howells 	RTM_NEWNEIGHTBL	= 64,
102607ca46eSDavid Howells #define RTM_NEWNEIGHTBL	RTM_NEWNEIGHTBL
103607ca46eSDavid Howells 	RTM_GETNEIGHTBL	= 66,
104607ca46eSDavid Howells #define RTM_GETNEIGHTBL	RTM_GETNEIGHTBL
105607ca46eSDavid Howells 	RTM_SETNEIGHTBL,
106607ca46eSDavid Howells #define RTM_SETNEIGHTBL	RTM_SETNEIGHTBL
107607ca46eSDavid Howells 
108607ca46eSDavid Howells 	RTM_NEWNDUSEROPT = 68,
109607ca46eSDavid Howells #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
110607ca46eSDavid Howells 
111607ca46eSDavid Howells 	RTM_NEWADDRLABEL = 72,
112607ca46eSDavid Howells #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
113607ca46eSDavid Howells 	RTM_DELADDRLABEL,
114607ca46eSDavid Howells #define RTM_DELADDRLABEL RTM_DELADDRLABEL
115607ca46eSDavid Howells 	RTM_GETADDRLABEL,
116607ca46eSDavid Howells #define RTM_GETADDRLABEL RTM_GETADDRLABEL
117607ca46eSDavid Howells 
118607ca46eSDavid Howells 	RTM_GETDCB = 78,
119607ca46eSDavid Howells #define RTM_GETDCB RTM_GETDCB
120607ca46eSDavid Howells 	RTM_SETDCB,
121607ca46eSDavid Howells #define RTM_SETDCB RTM_SETDCB
122607ca46eSDavid Howells 
123d900082bSNicolas Dichtel 	RTM_NEWNETCONF = 80,
124d900082bSNicolas Dichtel #define RTM_NEWNETCONF RTM_NEWNETCONF
125d900082bSNicolas Dichtel 	RTM_GETNETCONF = 82,
126d900082bSNicolas Dichtel #define RTM_GETNETCONF RTM_GETNETCONF
127d900082bSNicolas Dichtel 
128607ca46eSDavid Howells 	__RTM_MAX,
129607ca46eSDavid Howells #define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
130607ca46eSDavid Howells };
131607ca46eSDavid Howells 
132607ca46eSDavid Howells #define RTM_NR_MSGTYPES	(RTM_MAX + 1 - RTM_BASE)
133607ca46eSDavid Howells #define RTM_NR_FAMILIES	(RTM_NR_MSGTYPES >> 2)
134607ca46eSDavid Howells #define RTM_FAM(cmd)	(((cmd) - RTM_BASE) >> 2)
135607ca46eSDavid Howells 
136607ca46eSDavid Howells /*
137607ca46eSDavid Howells    Generic structure for encapsulation of optional route information.
138607ca46eSDavid Howells    It is reminiscent of sockaddr, but with sa_family replaced
139607ca46eSDavid Howells    with attribute type.
140607ca46eSDavid Howells  */
141607ca46eSDavid Howells 
142607ca46eSDavid Howells struct rtattr {
143607ca46eSDavid Howells 	unsigned short	rta_len;
144607ca46eSDavid Howells 	unsigned short	rta_type;
145607ca46eSDavid Howells };
146607ca46eSDavid Howells 
147607ca46eSDavid Howells /* Macros to handle rtattributes */
148607ca46eSDavid Howells 
149607ca46eSDavid Howells #define RTA_ALIGNTO	4
150607ca46eSDavid Howells #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
151607ca46eSDavid Howells #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
152607ca46eSDavid Howells 			 (rta)->rta_len >= sizeof(struct rtattr) && \
153607ca46eSDavid Howells 			 (rta)->rta_len <= (len))
154607ca46eSDavid Howells #define RTA_NEXT(rta,attrlen)	((attrlen) -= RTA_ALIGN((rta)->rta_len), \
155607ca46eSDavid Howells 				 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
156607ca46eSDavid Howells #define RTA_LENGTH(len)	(RTA_ALIGN(sizeof(struct rtattr)) + (len))
157607ca46eSDavid Howells #define RTA_SPACE(len)	RTA_ALIGN(RTA_LENGTH(len))
158607ca46eSDavid Howells #define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
159607ca46eSDavid Howells #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
160607ca46eSDavid Howells 
161607ca46eSDavid Howells 
162607ca46eSDavid Howells 
163607ca46eSDavid Howells 
164607ca46eSDavid Howells /******************************************************************************
165607ca46eSDavid Howells  *		Definitions used in routing table administration.
166607ca46eSDavid Howells  ****/
167607ca46eSDavid Howells 
168607ca46eSDavid Howells struct rtmsg {
169607ca46eSDavid Howells 	unsigned char		rtm_family;
170607ca46eSDavid Howells 	unsigned char		rtm_dst_len;
171607ca46eSDavid Howells 	unsigned char		rtm_src_len;
172607ca46eSDavid Howells 	unsigned char		rtm_tos;
173607ca46eSDavid Howells 
174607ca46eSDavid Howells 	unsigned char		rtm_table;	/* Routing table id */
175607ca46eSDavid Howells 	unsigned char		rtm_protocol;	/* Routing protocol; see below	*/
176607ca46eSDavid Howells 	unsigned char		rtm_scope;	/* See below */
177607ca46eSDavid Howells 	unsigned char		rtm_type;	/* See below	*/
178607ca46eSDavid Howells 
179607ca46eSDavid Howells 	unsigned		rtm_flags;
180607ca46eSDavid Howells };
181607ca46eSDavid Howells 
182607ca46eSDavid Howells /* rtm_type */
183607ca46eSDavid Howells 
184607ca46eSDavid Howells enum {
185607ca46eSDavid Howells 	RTN_UNSPEC,
186607ca46eSDavid Howells 	RTN_UNICAST,		/* Gateway or direct route	*/
187607ca46eSDavid Howells 	RTN_LOCAL,		/* Accept locally		*/
188607ca46eSDavid Howells 	RTN_BROADCAST,		/* Accept locally as broadcast,
189607ca46eSDavid Howells 				   send as broadcast */
190607ca46eSDavid Howells 	RTN_ANYCAST,		/* Accept locally as broadcast,
191607ca46eSDavid Howells 				   but send as unicast */
192607ca46eSDavid Howells 	RTN_MULTICAST,		/* Multicast route		*/
193607ca46eSDavid Howells 	RTN_BLACKHOLE,		/* Drop				*/
194607ca46eSDavid Howells 	RTN_UNREACHABLE,	/* Destination is unreachable   */
195607ca46eSDavid Howells 	RTN_PROHIBIT,		/* Administratively prohibited	*/
196607ca46eSDavid Howells 	RTN_THROW,		/* Not in this table		*/
197607ca46eSDavid Howells 	RTN_NAT,		/* Translate this address	*/
198607ca46eSDavid Howells 	RTN_XRESOLVE,		/* Use external resolver	*/
199607ca46eSDavid Howells 	__RTN_MAX
200607ca46eSDavid Howells };
201607ca46eSDavid Howells 
202607ca46eSDavid Howells #define RTN_MAX (__RTN_MAX - 1)
203607ca46eSDavid Howells 
204607ca46eSDavid Howells 
205607ca46eSDavid Howells /* rtm_protocol */
206607ca46eSDavid Howells 
207607ca46eSDavid Howells #define RTPROT_UNSPEC	0
208607ca46eSDavid Howells #define RTPROT_REDIRECT	1	/* Route installed by ICMP redirects;
209607ca46eSDavid Howells 				   not used by current IPv4 */
210607ca46eSDavid Howells #define RTPROT_KERNEL	2	/* Route installed by kernel		*/
211607ca46eSDavid Howells #define RTPROT_BOOT	3	/* Route installed during boot		*/
212607ca46eSDavid Howells #define RTPROT_STATIC	4	/* Route installed by administrator	*/
213607ca46eSDavid Howells 
214607ca46eSDavid Howells /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
215607ca46eSDavid Howells    they are just passed from user and back as is.
216607ca46eSDavid Howells    It will be used by hypothetical multiple routing daemons.
217607ca46eSDavid Howells    Note that protocol values should be standardized in order to
218607ca46eSDavid Howells    avoid conflicts.
219607ca46eSDavid Howells  */
220607ca46eSDavid Howells 
221607ca46eSDavid Howells #define RTPROT_GATED	8	/* Apparently, GateD */
222607ca46eSDavid Howells #define RTPROT_RA	9	/* RDISC/ND router advertisements */
223607ca46eSDavid Howells #define RTPROT_MRT	10	/* Merit MRT */
224607ca46eSDavid Howells #define RTPROT_ZEBRA	11	/* Zebra */
225607ca46eSDavid Howells #define RTPROT_BIRD	12	/* BIRD */
226607ca46eSDavid Howells #define RTPROT_DNROUTED	13	/* DECnet routing daemon */
227607ca46eSDavid Howells #define RTPROT_XORP	14	/* XORP */
228607ca46eSDavid Howells #define RTPROT_NTK	15	/* Netsukuku */
229607ca46eSDavid Howells #define RTPROT_DHCP	16      /* DHCP client */
2309a68ac72SNicolas Dichtel #define RTPROT_MROUTED	17      /* Multicast daemon */
231607ca46eSDavid Howells 
232607ca46eSDavid Howells /* rtm_scope
233607ca46eSDavid Howells 
234607ca46eSDavid Howells    Really it is not scope, but sort of distance to the destination.
235607ca46eSDavid Howells    NOWHERE are reserved for not existing destinations, HOST is our
236607ca46eSDavid Howells    local addresses, LINK are destinations, located on directly attached
237607ca46eSDavid Howells    link and UNIVERSE is everywhere in the Universe.
238607ca46eSDavid Howells 
239607ca46eSDavid Howells    Intermediate values are also possible f.e. interior routes
240607ca46eSDavid Howells    could be assigned a value between UNIVERSE and LINK.
241607ca46eSDavid Howells */
242607ca46eSDavid Howells 
243607ca46eSDavid Howells enum rt_scope_t {
244607ca46eSDavid Howells 	RT_SCOPE_UNIVERSE=0,
245607ca46eSDavid Howells /* User defined values  */
246607ca46eSDavid Howells 	RT_SCOPE_SITE=200,
247607ca46eSDavid Howells 	RT_SCOPE_LINK=253,
248607ca46eSDavid Howells 	RT_SCOPE_HOST=254,
249607ca46eSDavid Howells 	RT_SCOPE_NOWHERE=255
250607ca46eSDavid Howells };
251607ca46eSDavid Howells 
252607ca46eSDavid Howells /* rtm_flags */
253607ca46eSDavid Howells 
254607ca46eSDavid Howells #define RTM_F_NOTIFY		0x100	/* Notify user of route change	*/
255607ca46eSDavid Howells #define RTM_F_CLONED		0x200	/* This route is cloned		*/
256607ca46eSDavid Howells #define RTM_F_EQUALIZE		0x400	/* Multipath equalizer: NI	*/
257607ca46eSDavid Howells #define RTM_F_PREFIX		0x800	/* Prefix addresses		*/
258607ca46eSDavid Howells 
259607ca46eSDavid Howells /* Reserved table identifiers */
260607ca46eSDavid Howells 
261607ca46eSDavid Howells enum rt_class_t {
262607ca46eSDavid Howells 	RT_TABLE_UNSPEC=0,
263607ca46eSDavid Howells /* User defined values */
264607ca46eSDavid Howells 	RT_TABLE_COMPAT=252,
265607ca46eSDavid Howells 	RT_TABLE_DEFAULT=253,
266607ca46eSDavid Howells 	RT_TABLE_MAIN=254,
267607ca46eSDavid Howells 	RT_TABLE_LOCAL=255,
268607ca46eSDavid Howells 	RT_TABLE_MAX=0xFFFFFFFF
269607ca46eSDavid Howells };
270607ca46eSDavid Howells 
271607ca46eSDavid Howells 
272607ca46eSDavid Howells /* Routing message attributes */
273607ca46eSDavid Howells 
274607ca46eSDavid Howells enum rtattr_type_t {
275607ca46eSDavid Howells 	RTA_UNSPEC,
276607ca46eSDavid Howells 	RTA_DST,
277607ca46eSDavid Howells 	RTA_SRC,
278607ca46eSDavid Howells 	RTA_IIF,
279607ca46eSDavid Howells 	RTA_OIF,
280607ca46eSDavid Howells 	RTA_GATEWAY,
281607ca46eSDavid Howells 	RTA_PRIORITY,
282607ca46eSDavid Howells 	RTA_PREFSRC,
283607ca46eSDavid Howells 	RTA_METRICS,
284607ca46eSDavid Howells 	RTA_MULTIPATH,
285607ca46eSDavid Howells 	RTA_PROTOINFO, /* no longer used */
286607ca46eSDavid Howells 	RTA_FLOW,
287607ca46eSDavid Howells 	RTA_CACHEINFO,
288607ca46eSDavid Howells 	RTA_SESSION, /* no longer used */
289607ca46eSDavid Howells 	RTA_MP_ALGO, /* no longer used */
290607ca46eSDavid Howells 	RTA_TABLE,
291607ca46eSDavid Howells 	RTA_MARK,
292adfa85e4SNicolas Dichtel 	RTA_MFC_STATS,
293607ca46eSDavid Howells 	__RTA_MAX
294607ca46eSDavid Howells };
295607ca46eSDavid Howells 
296607ca46eSDavid Howells #define RTA_MAX (__RTA_MAX - 1)
297607ca46eSDavid Howells 
298607ca46eSDavid Howells #define RTM_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
299607ca46eSDavid Howells #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
300607ca46eSDavid Howells 
301607ca46eSDavid Howells /* RTM_MULTIPATH --- array of struct rtnexthop.
302607ca46eSDavid Howells  *
303607ca46eSDavid Howells  * "struct rtnexthop" describes all necessary nexthop information,
304607ca46eSDavid Howells  * i.e. parameters of path to a destination via this nexthop.
305607ca46eSDavid Howells  *
306607ca46eSDavid Howells  * At the moment it is impossible to set different prefsrc, mtu, window
307607ca46eSDavid Howells  * and rtt for different paths from multipath.
308607ca46eSDavid Howells  */
309607ca46eSDavid Howells 
310607ca46eSDavid Howells struct rtnexthop {
311607ca46eSDavid Howells 	unsigned short		rtnh_len;
312607ca46eSDavid Howells 	unsigned char		rtnh_flags;
313607ca46eSDavid Howells 	unsigned char		rtnh_hops;
314607ca46eSDavid Howells 	int			rtnh_ifindex;
315607ca46eSDavid Howells };
316607ca46eSDavid Howells 
317607ca46eSDavid Howells /* rtnh_flags */
318607ca46eSDavid Howells 
319607ca46eSDavid Howells #define RTNH_F_DEAD		1	/* Nexthop is dead (used by multipath)	*/
320607ca46eSDavid Howells #define RTNH_F_PERVASIVE	2	/* Do recursive gateway lookup	*/
321607ca46eSDavid Howells #define RTNH_F_ONLINK		4	/* Gateway is forced on link	*/
322607ca46eSDavid Howells 
323607ca46eSDavid Howells /* Macros to handle hexthops */
324607ca46eSDavid Howells 
325607ca46eSDavid Howells #define RTNH_ALIGNTO	4
326607ca46eSDavid Howells #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) )
327607ca46eSDavid Howells #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
328607ca46eSDavid Howells 			   ((int)(rtnh)->rtnh_len) <= (len))
329607ca46eSDavid Howells #define RTNH_NEXT(rtnh)	((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
330607ca46eSDavid Howells #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len))
331607ca46eSDavid Howells #define RTNH_SPACE(len)	RTNH_ALIGN(RTNH_LENGTH(len))
332607ca46eSDavid Howells #define RTNH_DATA(rtnh)   ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
333607ca46eSDavid Howells 
334607ca46eSDavid Howells /* RTM_CACHEINFO */
335607ca46eSDavid Howells 
336607ca46eSDavid Howells struct rta_cacheinfo {
337607ca46eSDavid Howells 	__u32	rta_clntref;
338607ca46eSDavid Howells 	__u32	rta_lastuse;
339607ca46eSDavid Howells 	__s32	rta_expires;
340607ca46eSDavid Howells 	__u32	rta_error;
341607ca46eSDavid Howells 	__u32	rta_used;
342607ca46eSDavid Howells 
343607ca46eSDavid Howells #define RTNETLINK_HAVE_PEERINFO 1
344607ca46eSDavid Howells 	__u32	rta_id;
345607ca46eSDavid Howells 	__u32	rta_ts;
346607ca46eSDavid Howells 	__u32	rta_tsage;
347607ca46eSDavid Howells };
348607ca46eSDavid Howells 
349607ca46eSDavid Howells /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
350607ca46eSDavid Howells 
351607ca46eSDavid Howells enum {
352607ca46eSDavid Howells 	RTAX_UNSPEC,
353607ca46eSDavid Howells #define RTAX_UNSPEC RTAX_UNSPEC
354607ca46eSDavid Howells 	RTAX_LOCK,
355607ca46eSDavid Howells #define RTAX_LOCK RTAX_LOCK
356607ca46eSDavid Howells 	RTAX_MTU,
357607ca46eSDavid Howells #define RTAX_MTU RTAX_MTU
358607ca46eSDavid Howells 	RTAX_WINDOW,
359607ca46eSDavid Howells #define RTAX_WINDOW RTAX_WINDOW
360607ca46eSDavid Howells 	RTAX_RTT,
361607ca46eSDavid Howells #define RTAX_RTT RTAX_RTT
362607ca46eSDavid Howells 	RTAX_RTTVAR,
363607ca46eSDavid Howells #define RTAX_RTTVAR RTAX_RTTVAR
364607ca46eSDavid Howells 	RTAX_SSTHRESH,
365607ca46eSDavid Howells #define RTAX_SSTHRESH RTAX_SSTHRESH
366607ca46eSDavid Howells 	RTAX_CWND,
367607ca46eSDavid Howells #define RTAX_CWND RTAX_CWND
368607ca46eSDavid Howells 	RTAX_ADVMSS,
369607ca46eSDavid Howells #define RTAX_ADVMSS RTAX_ADVMSS
370607ca46eSDavid Howells 	RTAX_REORDERING,
371607ca46eSDavid Howells #define RTAX_REORDERING RTAX_REORDERING
372607ca46eSDavid Howells 	RTAX_HOPLIMIT,
373607ca46eSDavid Howells #define RTAX_HOPLIMIT RTAX_HOPLIMIT
374607ca46eSDavid Howells 	RTAX_INITCWND,
375607ca46eSDavid Howells #define RTAX_INITCWND RTAX_INITCWND
376607ca46eSDavid Howells 	RTAX_FEATURES,
377607ca46eSDavid Howells #define RTAX_FEATURES RTAX_FEATURES
378607ca46eSDavid Howells 	RTAX_RTO_MIN,
379607ca46eSDavid Howells #define RTAX_RTO_MIN RTAX_RTO_MIN
380607ca46eSDavid Howells 	RTAX_INITRWND,
381607ca46eSDavid Howells #define RTAX_INITRWND RTAX_INITRWND
382607ca46eSDavid Howells 	__RTAX_MAX
383607ca46eSDavid Howells };
384607ca46eSDavid Howells 
385607ca46eSDavid Howells #define RTAX_MAX (__RTAX_MAX - 1)
386607ca46eSDavid Howells 
387607ca46eSDavid Howells #define RTAX_FEATURE_ECN	0x00000001
388607ca46eSDavid Howells #define RTAX_FEATURE_SACK	0x00000002
389607ca46eSDavid Howells #define RTAX_FEATURE_TIMESTAMP	0x00000004
390607ca46eSDavid Howells #define RTAX_FEATURE_ALLFRAG	0x00000008
391607ca46eSDavid Howells 
392607ca46eSDavid Howells struct rta_session {
393607ca46eSDavid Howells 	__u8	proto;
394607ca46eSDavid Howells 	__u8	pad1;
395607ca46eSDavid Howells 	__u16	pad2;
396607ca46eSDavid Howells 
397607ca46eSDavid Howells 	union {
398607ca46eSDavid Howells 		struct {
399607ca46eSDavid Howells 			__u16	sport;
400607ca46eSDavid Howells 			__u16	dport;
401607ca46eSDavid Howells 		} ports;
402607ca46eSDavid Howells 
403607ca46eSDavid Howells 		struct {
404607ca46eSDavid Howells 			__u8	type;
405607ca46eSDavid Howells 			__u8	code;
406607ca46eSDavid Howells 			__u16	ident;
407607ca46eSDavid Howells 		} icmpt;
408607ca46eSDavid Howells 
409607ca46eSDavid Howells 		__u32		spi;
410607ca46eSDavid Howells 	} u;
411607ca46eSDavid Howells };
412607ca46eSDavid Howells 
413adfa85e4SNicolas Dichtel struct rta_mfc_stats {
414adfa85e4SNicolas Dichtel 	__u64	mfcs_packets;
415adfa85e4SNicolas Dichtel 	__u64	mfcs_bytes;
416adfa85e4SNicolas Dichtel 	__u64	mfcs_wrong_if;
417adfa85e4SNicolas Dichtel };
418adfa85e4SNicolas Dichtel 
419607ca46eSDavid Howells /****
420607ca46eSDavid Howells  *		General form of address family dependent message.
421607ca46eSDavid Howells  ****/
422607ca46eSDavid Howells 
423607ca46eSDavid Howells struct rtgenmsg {
424607ca46eSDavid Howells 	unsigned char		rtgen_family;
425607ca46eSDavid Howells };
426607ca46eSDavid Howells 
427607ca46eSDavid Howells /*****************************************************************
428607ca46eSDavid Howells  *		Link layer specific messages.
429607ca46eSDavid Howells  ****/
430607ca46eSDavid Howells 
431607ca46eSDavid Howells /* struct ifinfomsg
432607ca46eSDavid Howells  * passes link level specific information, not dependent
433607ca46eSDavid Howells  * on network protocol.
434607ca46eSDavid Howells  */
435607ca46eSDavid Howells 
436607ca46eSDavid Howells struct ifinfomsg {
437607ca46eSDavid Howells 	unsigned char	ifi_family;
438607ca46eSDavid Howells 	unsigned char	__ifi_pad;
439607ca46eSDavid Howells 	unsigned short	ifi_type;		/* ARPHRD_* */
440607ca46eSDavid Howells 	int		ifi_index;		/* Link index	*/
441607ca46eSDavid Howells 	unsigned	ifi_flags;		/* IFF_* flags	*/
442607ca46eSDavid Howells 	unsigned	ifi_change;		/* IFF_* change mask */
443607ca46eSDavid Howells };
444607ca46eSDavid Howells 
445607ca46eSDavid Howells /********************************************************************
446607ca46eSDavid Howells  *		prefix information
447607ca46eSDavid Howells  ****/
448607ca46eSDavid Howells 
449607ca46eSDavid Howells struct prefixmsg {
450607ca46eSDavid Howells 	unsigned char	prefix_family;
451607ca46eSDavid Howells 	unsigned char	prefix_pad1;
452607ca46eSDavid Howells 	unsigned short	prefix_pad2;
453607ca46eSDavid Howells 	int		prefix_ifindex;
454607ca46eSDavid Howells 	unsigned char	prefix_type;
455607ca46eSDavid Howells 	unsigned char	prefix_len;
456607ca46eSDavid Howells 	unsigned char	prefix_flags;
457607ca46eSDavid Howells 	unsigned char	prefix_pad3;
458607ca46eSDavid Howells };
459607ca46eSDavid Howells 
460607ca46eSDavid Howells enum
461607ca46eSDavid Howells {
462607ca46eSDavid Howells 	PREFIX_UNSPEC,
463607ca46eSDavid Howells 	PREFIX_ADDRESS,
464607ca46eSDavid Howells 	PREFIX_CACHEINFO,
465607ca46eSDavid Howells 	__PREFIX_MAX
466607ca46eSDavid Howells };
467607ca46eSDavid Howells 
468607ca46eSDavid Howells #define PREFIX_MAX	(__PREFIX_MAX - 1)
469607ca46eSDavid Howells 
470607ca46eSDavid Howells struct prefix_cacheinfo {
471607ca46eSDavid Howells 	__u32	preferred_time;
472607ca46eSDavid Howells 	__u32	valid_time;
473607ca46eSDavid Howells };
474607ca46eSDavid Howells 
475607ca46eSDavid Howells 
476607ca46eSDavid Howells /*****************************************************************
477607ca46eSDavid Howells  *		Traffic control messages.
478607ca46eSDavid Howells  ****/
479607ca46eSDavid Howells 
480607ca46eSDavid Howells struct tcmsg {
481607ca46eSDavid Howells 	unsigned char	tcm_family;
482607ca46eSDavid Howells 	unsigned char	tcm__pad1;
483607ca46eSDavid Howells 	unsigned short	tcm__pad2;
484607ca46eSDavid Howells 	int		tcm_ifindex;
485607ca46eSDavid Howells 	__u32		tcm_handle;
486607ca46eSDavid Howells 	__u32		tcm_parent;
487607ca46eSDavid Howells 	__u32		tcm_info;
488607ca46eSDavid Howells };
489607ca46eSDavid Howells 
490607ca46eSDavid Howells enum {
491607ca46eSDavid Howells 	TCA_UNSPEC,
492607ca46eSDavid Howells 	TCA_KIND,
493607ca46eSDavid Howells 	TCA_OPTIONS,
494607ca46eSDavid Howells 	TCA_STATS,
495607ca46eSDavid Howells 	TCA_XSTATS,
496607ca46eSDavid Howells 	TCA_RATE,
497607ca46eSDavid Howells 	TCA_FCNT,
498607ca46eSDavid Howells 	TCA_STATS2,
499607ca46eSDavid Howells 	TCA_STAB,
500607ca46eSDavid Howells 	__TCA_MAX
501607ca46eSDavid Howells };
502607ca46eSDavid Howells 
503607ca46eSDavid Howells #define TCA_MAX (__TCA_MAX - 1)
504607ca46eSDavid Howells 
505607ca46eSDavid Howells #define TCA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
506607ca46eSDavid Howells #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
507607ca46eSDavid Howells 
508607ca46eSDavid Howells /********************************************************************
509607ca46eSDavid Howells  *		Neighbor Discovery userland options
510607ca46eSDavid Howells  ****/
511607ca46eSDavid Howells 
512607ca46eSDavid Howells struct nduseroptmsg {
513607ca46eSDavid Howells 	unsigned char	nduseropt_family;
514607ca46eSDavid Howells 	unsigned char	nduseropt_pad1;
515607ca46eSDavid Howells 	unsigned short	nduseropt_opts_len;	/* Total length of options */
516607ca46eSDavid Howells 	int		nduseropt_ifindex;
517607ca46eSDavid Howells 	__u8		nduseropt_icmp_type;
518607ca46eSDavid Howells 	__u8		nduseropt_icmp_code;
519607ca46eSDavid Howells 	unsigned short	nduseropt_pad2;
520607ca46eSDavid Howells 	unsigned int	nduseropt_pad3;
521607ca46eSDavid Howells 	/* Followed by one or more ND options */
522607ca46eSDavid Howells };
523607ca46eSDavid Howells 
524607ca46eSDavid Howells enum {
525607ca46eSDavid Howells 	NDUSEROPT_UNSPEC,
526607ca46eSDavid Howells 	NDUSEROPT_SRCADDR,
527607ca46eSDavid Howells 	__NDUSEROPT_MAX
528607ca46eSDavid Howells };
529607ca46eSDavid Howells 
530607ca46eSDavid Howells #define NDUSEROPT_MAX	(__NDUSEROPT_MAX - 1)
531607ca46eSDavid Howells 
532607ca46eSDavid Howells #ifndef __KERNEL__
533607ca46eSDavid Howells /* RTnetlink multicast groups - backwards compatibility for userspace */
534607ca46eSDavid Howells #define RTMGRP_LINK		1
535607ca46eSDavid Howells #define RTMGRP_NOTIFY		2
536607ca46eSDavid Howells #define RTMGRP_NEIGH		4
537607ca46eSDavid Howells #define RTMGRP_TC		8
538607ca46eSDavid Howells 
539607ca46eSDavid Howells #define RTMGRP_IPV4_IFADDR	0x10
540607ca46eSDavid Howells #define RTMGRP_IPV4_MROUTE	0x20
541607ca46eSDavid Howells #define RTMGRP_IPV4_ROUTE	0x40
542607ca46eSDavid Howells #define RTMGRP_IPV4_RULE	0x80
543607ca46eSDavid Howells 
544607ca46eSDavid Howells #define RTMGRP_IPV6_IFADDR	0x100
545607ca46eSDavid Howells #define RTMGRP_IPV6_MROUTE	0x200
546607ca46eSDavid Howells #define RTMGRP_IPV6_ROUTE	0x400
547607ca46eSDavid Howells #define RTMGRP_IPV6_IFINFO	0x800
548607ca46eSDavid Howells 
549607ca46eSDavid Howells #define RTMGRP_DECnet_IFADDR    0x1000
550607ca46eSDavid Howells #define RTMGRP_DECnet_ROUTE     0x4000
551607ca46eSDavid Howells 
552607ca46eSDavid Howells #define RTMGRP_IPV6_PREFIX	0x20000
553607ca46eSDavid Howells #endif
554607ca46eSDavid Howells 
555607ca46eSDavid Howells /* RTnetlink multicast groups */
556607ca46eSDavid Howells enum rtnetlink_groups {
557607ca46eSDavid Howells 	RTNLGRP_NONE,
558607ca46eSDavid Howells #define RTNLGRP_NONE		RTNLGRP_NONE
559607ca46eSDavid Howells 	RTNLGRP_LINK,
560607ca46eSDavid Howells #define RTNLGRP_LINK		RTNLGRP_LINK
561607ca46eSDavid Howells 	RTNLGRP_NOTIFY,
562607ca46eSDavid Howells #define RTNLGRP_NOTIFY		RTNLGRP_NOTIFY
563607ca46eSDavid Howells 	RTNLGRP_NEIGH,
564607ca46eSDavid Howells #define RTNLGRP_NEIGH		RTNLGRP_NEIGH
565607ca46eSDavid Howells 	RTNLGRP_TC,
566607ca46eSDavid Howells #define RTNLGRP_TC		RTNLGRP_TC
567607ca46eSDavid Howells 	RTNLGRP_IPV4_IFADDR,
568607ca46eSDavid Howells #define RTNLGRP_IPV4_IFADDR	RTNLGRP_IPV4_IFADDR
569607ca46eSDavid Howells 	RTNLGRP_IPV4_MROUTE,
570607ca46eSDavid Howells #define	RTNLGRP_IPV4_MROUTE	RTNLGRP_IPV4_MROUTE
571607ca46eSDavid Howells 	RTNLGRP_IPV4_ROUTE,
572607ca46eSDavid Howells #define RTNLGRP_IPV4_ROUTE	RTNLGRP_IPV4_ROUTE
573607ca46eSDavid Howells 	RTNLGRP_IPV4_RULE,
574607ca46eSDavid Howells #define RTNLGRP_IPV4_RULE	RTNLGRP_IPV4_RULE
575607ca46eSDavid Howells 	RTNLGRP_IPV6_IFADDR,
576607ca46eSDavid Howells #define RTNLGRP_IPV6_IFADDR	RTNLGRP_IPV6_IFADDR
577607ca46eSDavid Howells 	RTNLGRP_IPV6_MROUTE,
578607ca46eSDavid Howells #define RTNLGRP_IPV6_MROUTE	RTNLGRP_IPV6_MROUTE
579607ca46eSDavid Howells 	RTNLGRP_IPV6_ROUTE,
580607ca46eSDavid Howells #define RTNLGRP_IPV6_ROUTE	RTNLGRP_IPV6_ROUTE
581607ca46eSDavid Howells 	RTNLGRP_IPV6_IFINFO,
582607ca46eSDavid Howells #define RTNLGRP_IPV6_IFINFO	RTNLGRP_IPV6_IFINFO
583607ca46eSDavid Howells 	RTNLGRP_DECnet_IFADDR,
584607ca46eSDavid Howells #define RTNLGRP_DECnet_IFADDR	RTNLGRP_DECnet_IFADDR
585607ca46eSDavid Howells 	RTNLGRP_NOP2,
586607ca46eSDavid Howells 	RTNLGRP_DECnet_ROUTE,
587607ca46eSDavid Howells #define RTNLGRP_DECnet_ROUTE	RTNLGRP_DECnet_ROUTE
588607ca46eSDavid Howells 	RTNLGRP_DECnet_RULE,
589607ca46eSDavid Howells #define RTNLGRP_DECnet_RULE	RTNLGRP_DECnet_RULE
590607ca46eSDavid Howells 	RTNLGRP_NOP4,
591607ca46eSDavid Howells 	RTNLGRP_IPV6_PREFIX,
592607ca46eSDavid Howells #define RTNLGRP_IPV6_PREFIX	RTNLGRP_IPV6_PREFIX
593607ca46eSDavid Howells 	RTNLGRP_IPV6_RULE,
594607ca46eSDavid Howells #define RTNLGRP_IPV6_RULE	RTNLGRP_IPV6_RULE
595607ca46eSDavid Howells 	RTNLGRP_ND_USEROPT,
596607ca46eSDavid Howells #define RTNLGRP_ND_USEROPT	RTNLGRP_ND_USEROPT
597607ca46eSDavid Howells 	RTNLGRP_PHONET_IFADDR,
598607ca46eSDavid Howells #define RTNLGRP_PHONET_IFADDR	RTNLGRP_PHONET_IFADDR
599607ca46eSDavid Howells 	RTNLGRP_PHONET_ROUTE,
600607ca46eSDavid Howells #define RTNLGRP_PHONET_ROUTE	RTNLGRP_PHONET_ROUTE
601607ca46eSDavid Howells 	RTNLGRP_DCB,
602607ca46eSDavid Howells #define RTNLGRP_DCB		RTNLGRP_DCB
603edc9e748SNicolas Dichtel 	RTNLGRP_IPV4_NETCONF,
604edc9e748SNicolas Dichtel #define RTNLGRP_IPV4_NETCONF	RTNLGRP_IPV4_NETCONF
605f3a1bfb1SNicolas Dichtel 	RTNLGRP_IPV6_NETCONF,
606f3a1bfb1SNicolas Dichtel #define RTNLGRP_IPV6_NETCONF	RTNLGRP_IPV6_NETCONF
607607ca46eSDavid Howells 	__RTNLGRP_MAX
608607ca46eSDavid Howells };
609607ca46eSDavid Howells #define RTNLGRP_MAX	(__RTNLGRP_MAX - 1)
610607ca46eSDavid Howells 
611607ca46eSDavid Howells /* TC action piece */
612607ca46eSDavid Howells struct tcamsg {
613607ca46eSDavid Howells 	unsigned char	tca_family;
614607ca46eSDavid Howells 	unsigned char	tca__pad1;
615607ca46eSDavid Howells 	unsigned short	tca__pad2;
616607ca46eSDavid Howells };
617607ca46eSDavid Howells #define TA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
618607ca46eSDavid Howells #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
619607ca46eSDavid Howells #define TCA_ACT_TAB 1 /* attr type must be >=1 */
620607ca46eSDavid Howells #define TCAA_MAX 1
621607ca46eSDavid Howells 
622607ca46eSDavid Howells /* New extended info filters for IFLA_EXT_MASK */
623607ca46eSDavid Howells #define RTEXT_FILTER_VF		(1 << 0)
624607ca46eSDavid Howells 
625607ca46eSDavid Howells /* End of information exported to user level */
626607ca46eSDavid Howells 
627607ca46eSDavid Howells 
628607ca46eSDavid Howells 
629607ca46eSDavid Howells #endif /* _UAPI__LINUX_RTNETLINK_H */
630