David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 1 | #ifndef _UAPI__LINUX_RTNETLINK_H |
| 2 | #define _UAPI__LINUX_RTNETLINK_H |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | #include <linux/netlink.h> |
| 6 | #include <linux/if_link.h> |
| 7 | #include <linux/if_addr.h> |
| 8 | #include <linux/neighbour.h> |
| 9 | |
| 10 | /* rtnetlink families. Values up to 127 are reserved for real address |
| 11 | * families, values above 128 may be used arbitrarily. |
| 12 | */ |
| 13 | #define RTNL_FAMILY_IPMR 128 |
| 14 | #define RTNL_FAMILY_IP6MR 129 |
| 15 | #define RTNL_FAMILY_MAX 129 |
| 16 | |
| 17 | /**** |
| 18 | * Routing/neighbour discovery messages. |
| 19 | ****/ |
| 20 | |
| 21 | /* Types of messages */ |
| 22 | |
| 23 | enum { |
| 24 | RTM_BASE = 16, |
| 25 | #define RTM_BASE RTM_BASE |
| 26 | |
| 27 | RTM_NEWLINK = 16, |
| 28 | #define RTM_NEWLINK RTM_NEWLINK |
| 29 | RTM_DELLINK, |
| 30 | #define RTM_DELLINK RTM_DELLINK |
| 31 | RTM_GETLINK, |
| 32 | #define RTM_GETLINK RTM_GETLINK |
| 33 | RTM_SETLINK, |
| 34 | #define RTM_SETLINK RTM_SETLINK |
| 35 | |
| 36 | RTM_NEWADDR = 20, |
| 37 | #define RTM_NEWADDR RTM_NEWADDR |
| 38 | RTM_DELADDR, |
| 39 | #define RTM_DELADDR RTM_DELADDR |
| 40 | RTM_GETADDR, |
| 41 | #define RTM_GETADDR RTM_GETADDR |
| 42 | |
| 43 | RTM_NEWROUTE = 24, |
| 44 | #define RTM_NEWROUTE RTM_NEWROUTE |
| 45 | RTM_DELROUTE, |
| 46 | #define RTM_DELROUTE RTM_DELROUTE |
| 47 | RTM_GETROUTE, |
| 48 | #define RTM_GETROUTE RTM_GETROUTE |
| 49 | |
| 50 | RTM_NEWNEIGH = 28, |
| 51 | #define RTM_NEWNEIGH RTM_NEWNEIGH |
| 52 | RTM_DELNEIGH, |
| 53 | #define RTM_DELNEIGH RTM_DELNEIGH |
| 54 | RTM_GETNEIGH, |
| 55 | #define RTM_GETNEIGH RTM_GETNEIGH |
| 56 | |
| 57 | RTM_NEWRULE = 32, |
| 58 | #define RTM_NEWRULE RTM_NEWRULE |
| 59 | RTM_DELRULE, |
| 60 | #define RTM_DELRULE RTM_DELRULE |
| 61 | RTM_GETRULE, |
| 62 | #define RTM_GETRULE RTM_GETRULE |
| 63 | |
| 64 | RTM_NEWQDISC = 36, |
| 65 | #define RTM_NEWQDISC RTM_NEWQDISC |
| 66 | RTM_DELQDISC, |
| 67 | #define RTM_DELQDISC RTM_DELQDISC |
| 68 | RTM_GETQDISC, |
| 69 | #define RTM_GETQDISC RTM_GETQDISC |
| 70 | |
| 71 | RTM_NEWTCLASS = 40, |
| 72 | #define RTM_NEWTCLASS RTM_NEWTCLASS |
| 73 | RTM_DELTCLASS, |
| 74 | #define RTM_DELTCLASS RTM_DELTCLASS |
| 75 | RTM_GETTCLASS, |
| 76 | #define RTM_GETTCLASS RTM_GETTCLASS |
| 77 | |
| 78 | RTM_NEWTFILTER = 44, |
| 79 | #define RTM_NEWTFILTER RTM_NEWTFILTER |
| 80 | RTM_DELTFILTER, |
| 81 | #define RTM_DELTFILTER RTM_DELTFILTER |
| 82 | RTM_GETTFILTER, |
| 83 | #define RTM_GETTFILTER RTM_GETTFILTER |
| 84 | |
| 85 | RTM_NEWACTION = 48, |
| 86 | #define RTM_NEWACTION RTM_NEWACTION |
| 87 | RTM_DELACTION, |
| 88 | #define RTM_DELACTION RTM_DELACTION |
| 89 | RTM_GETACTION, |
| 90 | #define RTM_GETACTION RTM_GETACTION |
| 91 | |
| 92 | RTM_NEWPREFIX = 52, |
| 93 | #define RTM_NEWPREFIX RTM_NEWPREFIX |
| 94 | |
| 95 | RTM_GETMULTICAST = 58, |
| 96 | #define RTM_GETMULTICAST RTM_GETMULTICAST |
| 97 | |
| 98 | RTM_GETANYCAST = 62, |
| 99 | #define RTM_GETANYCAST RTM_GETANYCAST |
| 100 | |
| 101 | RTM_NEWNEIGHTBL = 64, |
| 102 | #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL |
| 103 | RTM_GETNEIGHTBL = 66, |
| 104 | #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL |
| 105 | RTM_SETNEIGHTBL, |
| 106 | #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL |
| 107 | |
| 108 | RTM_NEWNDUSEROPT = 68, |
| 109 | #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT |
| 110 | |
| 111 | RTM_NEWADDRLABEL = 72, |
| 112 | #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL |
| 113 | RTM_DELADDRLABEL, |
| 114 | #define RTM_DELADDRLABEL RTM_DELADDRLABEL |
| 115 | RTM_GETADDRLABEL, |
| 116 | #define RTM_GETADDRLABEL RTM_GETADDRLABEL |
| 117 | |
| 118 | RTM_GETDCB = 78, |
| 119 | #define RTM_GETDCB RTM_GETDCB |
| 120 | RTM_SETDCB, |
| 121 | #define RTM_SETDCB RTM_SETDCB |
| 122 | |
Nicolas Dichtel | d900082 | 2012-10-25 22:28:49 +0000 | [diff] [blame] | 123 | RTM_NEWNETCONF = 80, |
| 124 | #define RTM_NEWNETCONF RTM_NEWNETCONF |
| 125 | RTM_GETNETCONF = 82, |
| 126 | #define RTM_GETNETCONF RTM_GETNETCONF |
| 127 | |
Cong Wang | 37a393b | 2012-12-11 22:23:07 +0000 | [diff] [blame] | 128 | RTM_NEWMDB = 84, |
| 129 | #define RTM_NEWMDB RTM_NEWMDB |
| 130 | RTM_DELMDB = 85, |
| 131 | #define RTM_DELMDB RTM_DELMDB |
Cong Wang | ee07c6e | 2012-12-07 00:04:48 +0000 | [diff] [blame] | 132 | RTM_GETMDB = 86, |
| 133 | #define RTM_GETMDB RTM_GETMDB |
| 134 | |
Nicolas Dichtel | 0c7aecd | 2015-01-15 15:11:15 +0100 | [diff] [blame] | 135 | RTM_NEWNSID = 88, |
| 136 | #define RTM_NEWNSID RTM_NEWNSID |
Nicolas Dichtel | 9a96345 | 2015-04-07 11:51:53 +0200 | [diff] [blame] | 137 | RTM_DELNSID = 89, |
| 138 | #define RTM_DELNSID RTM_DELNSID |
Nicolas Dichtel | 0c7aecd | 2015-01-15 15:11:15 +0100 | [diff] [blame] | 139 | RTM_GETNSID = 90, |
| 140 | #define RTM_GETNSID RTM_GETNSID |
| 141 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 142 | __RTM_MAX, |
| 143 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) |
| 144 | }; |
| 145 | |
| 146 | #define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) |
| 147 | #define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) |
| 148 | #define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) |
| 149 | |
| 150 | /* |
| 151 | Generic structure for encapsulation of optional route information. |
| 152 | It is reminiscent of sockaddr, but with sa_family replaced |
| 153 | with attribute type. |
| 154 | */ |
| 155 | |
| 156 | struct rtattr { |
| 157 | unsigned short rta_len; |
| 158 | unsigned short rta_type; |
| 159 | }; |
| 160 | |
| 161 | /* Macros to handle rtattributes */ |
| 162 | |
| 163 | #define RTA_ALIGNTO 4 |
| 164 | #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) |
| 165 | #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ |
| 166 | (rta)->rta_len >= sizeof(struct rtattr) && \ |
| 167 | (rta)->rta_len <= (len)) |
| 168 | #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ |
| 169 | (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) |
| 170 | #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) |
| 171 | #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) |
| 172 | #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) |
| 173 | #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | /****************************************************************************** |
| 179 | * Definitions used in routing table administration. |
| 180 | ****/ |
| 181 | |
| 182 | struct rtmsg { |
| 183 | unsigned char rtm_family; |
| 184 | unsigned char rtm_dst_len; |
| 185 | unsigned char rtm_src_len; |
| 186 | unsigned char rtm_tos; |
| 187 | |
| 188 | unsigned char rtm_table; /* Routing table id */ |
| 189 | unsigned char rtm_protocol; /* Routing protocol; see below */ |
| 190 | unsigned char rtm_scope; /* See below */ |
| 191 | unsigned char rtm_type; /* See below */ |
| 192 | |
| 193 | unsigned rtm_flags; |
| 194 | }; |
| 195 | |
| 196 | /* rtm_type */ |
| 197 | |
| 198 | enum { |
| 199 | RTN_UNSPEC, |
| 200 | RTN_UNICAST, /* Gateway or direct route */ |
| 201 | RTN_LOCAL, /* Accept locally */ |
| 202 | RTN_BROADCAST, /* Accept locally as broadcast, |
| 203 | send as broadcast */ |
| 204 | RTN_ANYCAST, /* Accept locally as broadcast, |
| 205 | but send as unicast */ |
| 206 | RTN_MULTICAST, /* Multicast route */ |
| 207 | RTN_BLACKHOLE, /* Drop */ |
| 208 | RTN_UNREACHABLE, /* Destination is unreachable */ |
| 209 | RTN_PROHIBIT, /* Administratively prohibited */ |
| 210 | RTN_THROW, /* Not in this table */ |
| 211 | RTN_NAT, /* Translate this address */ |
| 212 | RTN_XRESOLVE, /* Use external resolver */ |
| 213 | __RTN_MAX |
| 214 | }; |
| 215 | |
| 216 | #define RTN_MAX (__RTN_MAX - 1) |
| 217 | |
| 218 | |
| 219 | /* rtm_protocol */ |
| 220 | |
| 221 | #define RTPROT_UNSPEC 0 |
| 222 | #define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; |
| 223 | not used by current IPv4 */ |
| 224 | #define RTPROT_KERNEL 2 /* Route installed by kernel */ |
| 225 | #define RTPROT_BOOT 3 /* Route installed during boot */ |
| 226 | #define RTPROT_STATIC 4 /* Route installed by administrator */ |
| 227 | |
| 228 | /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; |
| 229 | they are just passed from user and back as is. |
| 230 | It will be used by hypothetical multiple routing daemons. |
| 231 | Note that protocol values should be standardized in order to |
| 232 | avoid conflicts. |
| 233 | */ |
| 234 | |
| 235 | #define RTPROT_GATED 8 /* Apparently, GateD */ |
| 236 | #define RTPROT_RA 9 /* RDISC/ND router advertisements */ |
| 237 | #define RTPROT_MRT 10 /* Merit MRT */ |
| 238 | #define RTPROT_ZEBRA 11 /* Zebra */ |
| 239 | #define RTPROT_BIRD 12 /* BIRD */ |
| 240 | #define RTPROT_DNROUTED 13 /* DECnet routing daemon */ |
| 241 | #define RTPROT_XORP 14 /* XORP */ |
| 242 | #define RTPROT_NTK 15 /* Netsukuku */ |
| 243 | #define RTPROT_DHCP 16 /* DHCP client */ |
Nicolas Dichtel | 9a68ac7 | 2012-12-04 01:13:38 +0000 | [diff] [blame] | 244 | #define RTPROT_MROUTED 17 /* Multicast daemon */ |
Dave Taht | be955b2 | 2014-11-06 08:10:14 -0800 | [diff] [blame] | 245 | #define RTPROT_BABEL 42 /* Babel daemon */ |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 246 | |
| 247 | /* rtm_scope |
| 248 | |
| 249 | Really it is not scope, but sort of distance to the destination. |
| 250 | NOWHERE are reserved for not existing destinations, HOST is our |
| 251 | local addresses, LINK are destinations, located on directly attached |
| 252 | link and UNIVERSE is everywhere in the Universe. |
| 253 | |
| 254 | Intermediate values are also possible f.e. interior routes |
| 255 | could be assigned a value between UNIVERSE and LINK. |
| 256 | */ |
| 257 | |
| 258 | enum rt_scope_t { |
| 259 | RT_SCOPE_UNIVERSE=0, |
| 260 | /* User defined values */ |
| 261 | RT_SCOPE_SITE=200, |
| 262 | RT_SCOPE_LINK=253, |
| 263 | RT_SCOPE_HOST=254, |
| 264 | RT_SCOPE_NOWHERE=255 |
| 265 | }; |
| 266 | |
| 267 | /* rtm_flags */ |
| 268 | |
| 269 | #define RTM_F_NOTIFY 0x100 /* Notify user of route change */ |
| 270 | #define RTM_F_CLONED 0x200 /* This route is cloned */ |
| 271 | #define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ |
| 272 | #define RTM_F_PREFIX 0x800 /* Prefix addresses */ |
| 273 | |
| 274 | /* Reserved table identifiers */ |
| 275 | |
| 276 | enum rt_class_t { |
| 277 | RT_TABLE_UNSPEC=0, |
| 278 | /* User defined values */ |
| 279 | RT_TABLE_COMPAT=252, |
| 280 | RT_TABLE_DEFAULT=253, |
| 281 | RT_TABLE_MAIN=254, |
| 282 | RT_TABLE_LOCAL=255, |
| 283 | RT_TABLE_MAX=0xFFFFFFFF |
| 284 | }; |
| 285 | |
| 286 | |
| 287 | /* Routing message attributes */ |
| 288 | |
| 289 | enum rtattr_type_t { |
| 290 | RTA_UNSPEC, |
| 291 | RTA_DST, |
| 292 | RTA_SRC, |
| 293 | RTA_IIF, |
| 294 | RTA_OIF, |
| 295 | RTA_GATEWAY, |
| 296 | RTA_PRIORITY, |
| 297 | RTA_PREFSRC, |
| 298 | RTA_METRICS, |
| 299 | RTA_MULTIPATH, |
| 300 | RTA_PROTOINFO, /* no longer used */ |
| 301 | RTA_FLOW, |
| 302 | RTA_CACHEINFO, |
| 303 | RTA_SESSION, /* no longer used */ |
| 304 | RTA_MP_ALGO, /* no longer used */ |
| 305 | RTA_TABLE, |
| 306 | RTA_MARK, |
Nicolas Dichtel | adfa85e | 2012-12-04 01:13:37 +0000 | [diff] [blame] | 307 | RTA_MFC_STATS, |
Eric W. Biederman | 03c0566 | 2015-03-03 19:13:56 -0600 | [diff] [blame] | 308 | RTA_VIA, |
| 309 | RTA_NEWDST, |
Lubomir Rintel | c78ba6d | 2015-03-11 15:39:21 +0100 | [diff] [blame] | 310 | RTA_PREF, |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 311 | __RTA_MAX |
| 312 | }; |
| 313 | |
| 314 | #define RTA_MAX (__RTA_MAX - 1) |
| 315 | |
| 316 | #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) |
| 317 | #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) |
| 318 | |
| 319 | /* RTM_MULTIPATH --- array of struct rtnexthop. |
| 320 | * |
| 321 | * "struct rtnexthop" describes all necessary nexthop information, |
| 322 | * i.e. parameters of path to a destination via this nexthop. |
| 323 | * |
| 324 | * At the moment it is impossible to set different prefsrc, mtu, window |
| 325 | * and rtt for different paths from multipath. |
| 326 | */ |
| 327 | |
| 328 | struct rtnexthop { |
| 329 | unsigned short rtnh_len; |
| 330 | unsigned char rtnh_flags; |
| 331 | unsigned char rtnh_hops; |
| 332 | int rtnh_ifindex; |
| 333 | }; |
| 334 | |
| 335 | /* rtnh_flags */ |
| 336 | |
| 337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ |
| 338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ |
| 339 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ |
Roopa Prabhu | eea3994 | 2015-05-13 21:17:41 -0700 | [diff] [blame] | 340 | #define RTNH_F_OFFLOAD 8 /* offloaded route */ |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 341 | |
| 342 | /* Macros to handle hexthops */ |
| 343 | |
| 344 | #define RTNH_ALIGNTO 4 |
| 345 | #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) |
| 346 | #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ |
| 347 | ((int)(rtnh)->rtnh_len) <= (len)) |
| 348 | #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) |
| 349 | #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) |
| 350 | #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) |
| 351 | #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) |
| 352 | |
Eric W. Biederman | 03c0566 | 2015-03-03 19:13:56 -0600 | [diff] [blame] | 353 | /* RTA_VIA */ |
| 354 | struct rtvia { |
| 355 | __kernel_sa_family_t rtvia_family; |
| 356 | __u8 rtvia_addr[0]; |
| 357 | }; |
| 358 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 359 | /* RTM_CACHEINFO */ |
| 360 | |
| 361 | struct rta_cacheinfo { |
| 362 | __u32 rta_clntref; |
| 363 | __u32 rta_lastuse; |
| 364 | __s32 rta_expires; |
| 365 | __u32 rta_error; |
| 366 | __u32 rta_used; |
| 367 | |
| 368 | #define RTNETLINK_HAVE_PEERINFO 1 |
| 369 | __u32 rta_id; |
| 370 | __u32 rta_ts; |
| 371 | __u32 rta_tsage; |
| 372 | }; |
| 373 | |
| 374 | /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ |
| 375 | |
| 376 | enum { |
| 377 | RTAX_UNSPEC, |
| 378 | #define RTAX_UNSPEC RTAX_UNSPEC |
| 379 | RTAX_LOCK, |
| 380 | #define RTAX_LOCK RTAX_LOCK |
| 381 | RTAX_MTU, |
| 382 | #define RTAX_MTU RTAX_MTU |
| 383 | RTAX_WINDOW, |
| 384 | #define RTAX_WINDOW RTAX_WINDOW |
| 385 | RTAX_RTT, |
| 386 | #define RTAX_RTT RTAX_RTT |
| 387 | RTAX_RTTVAR, |
| 388 | #define RTAX_RTTVAR RTAX_RTTVAR |
| 389 | RTAX_SSTHRESH, |
| 390 | #define RTAX_SSTHRESH RTAX_SSTHRESH |
| 391 | RTAX_CWND, |
| 392 | #define RTAX_CWND RTAX_CWND |
| 393 | RTAX_ADVMSS, |
| 394 | #define RTAX_ADVMSS RTAX_ADVMSS |
| 395 | RTAX_REORDERING, |
| 396 | #define RTAX_REORDERING RTAX_REORDERING |
| 397 | RTAX_HOPLIMIT, |
| 398 | #define RTAX_HOPLIMIT RTAX_HOPLIMIT |
| 399 | RTAX_INITCWND, |
| 400 | #define RTAX_INITCWND RTAX_INITCWND |
| 401 | RTAX_FEATURES, |
| 402 | #define RTAX_FEATURES RTAX_FEATURES |
| 403 | RTAX_RTO_MIN, |
| 404 | #define RTAX_RTO_MIN RTAX_RTO_MIN |
| 405 | RTAX_INITRWND, |
| 406 | #define RTAX_INITRWND RTAX_INITRWND |
Cong Wang | bcefe17 | 2013-06-15 09:39:18 +0800 | [diff] [blame] | 407 | RTAX_QUICKACK, |
| 408 | #define RTAX_QUICKACK RTAX_QUICKACK |
Daniel Borkmann | ea69763 | 2015-01-05 23:57:47 +0100 | [diff] [blame] | 409 | RTAX_CC_ALGO, |
| 410 | #define RTAX_CC_ALGO RTAX_CC_ALGO |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 411 | __RTAX_MAX |
| 412 | }; |
| 413 | |
| 414 | #define RTAX_MAX (__RTAX_MAX - 1) |
| 415 | |
| 416 | #define RTAX_FEATURE_ECN 0x00000001 |
| 417 | #define RTAX_FEATURE_SACK 0x00000002 |
| 418 | #define RTAX_FEATURE_TIMESTAMP 0x00000004 |
| 419 | #define RTAX_FEATURE_ALLFRAG 0x00000008 |
| 420 | |
| 421 | struct rta_session { |
| 422 | __u8 proto; |
| 423 | __u8 pad1; |
| 424 | __u16 pad2; |
| 425 | |
| 426 | union { |
| 427 | struct { |
| 428 | __u16 sport; |
| 429 | __u16 dport; |
| 430 | } ports; |
| 431 | |
| 432 | struct { |
| 433 | __u8 type; |
| 434 | __u8 code; |
| 435 | __u16 ident; |
| 436 | } icmpt; |
| 437 | |
| 438 | __u32 spi; |
| 439 | } u; |
| 440 | }; |
| 441 | |
Nicolas Dichtel | adfa85e | 2012-12-04 01:13:37 +0000 | [diff] [blame] | 442 | struct rta_mfc_stats { |
| 443 | __u64 mfcs_packets; |
| 444 | __u64 mfcs_bytes; |
| 445 | __u64 mfcs_wrong_if; |
| 446 | }; |
| 447 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 448 | /**** |
| 449 | * General form of address family dependent message. |
| 450 | ****/ |
| 451 | |
| 452 | struct rtgenmsg { |
| 453 | unsigned char rtgen_family; |
| 454 | }; |
| 455 | |
| 456 | /***************************************************************** |
| 457 | * Link layer specific messages. |
| 458 | ****/ |
| 459 | |
| 460 | /* struct ifinfomsg |
| 461 | * passes link level specific information, not dependent |
| 462 | * on network protocol. |
| 463 | */ |
| 464 | |
| 465 | struct ifinfomsg { |
| 466 | unsigned char ifi_family; |
| 467 | unsigned char __ifi_pad; |
| 468 | unsigned short ifi_type; /* ARPHRD_* */ |
| 469 | int ifi_index; /* Link index */ |
| 470 | unsigned ifi_flags; /* IFF_* flags */ |
| 471 | unsigned ifi_change; /* IFF_* change mask */ |
| 472 | }; |
| 473 | |
| 474 | /******************************************************************** |
| 475 | * prefix information |
| 476 | ****/ |
| 477 | |
| 478 | struct prefixmsg { |
| 479 | unsigned char prefix_family; |
| 480 | unsigned char prefix_pad1; |
| 481 | unsigned short prefix_pad2; |
| 482 | int prefix_ifindex; |
| 483 | unsigned char prefix_type; |
| 484 | unsigned char prefix_len; |
| 485 | unsigned char prefix_flags; |
| 486 | unsigned char prefix_pad3; |
| 487 | }; |
| 488 | |
| 489 | enum |
| 490 | { |
| 491 | PREFIX_UNSPEC, |
| 492 | PREFIX_ADDRESS, |
| 493 | PREFIX_CACHEINFO, |
| 494 | __PREFIX_MAX |
| 495 | }; |
| 496 | |
| 497 | #define PREFIX_MAX (__PREFIX_MAX - 1) |
| 498 | |
| 499 | struct prefix_cacheinfo { |
| 500 | __u32 preferred_time; |
| 501 | __u32 valid_time; |
| 502 | }; |
| 503 | |
| 504 | |
| 505 | /***************************************************************** |
| 506 | * Traffic control messages. |
| 507 | ****/ |
| 508 | |
| 509 | struct tcmsg { |
| 510 | unsigned char tcm_family; |
| 511 | unsigned char tcm__pad1; |
| 512 | unsigned short tcm__pad2; |
| 513 | int tcm_ifindex; |
| 514 | __u32 tcm_handle; |
| 515 | __u32 tcm_parent; |
| 516 | __u32 tcm_info; |
| 517 | }; |
| 518 | |
| 519 | enum { |
| 520 | TCA_UNSPEC, |
| 521 | TCA_KIND, |
| 522 | TCA_OPTIONS, |
| 523 | TCA_STATS, |
| 524 | TCA_XSTATS, |
| 525 | TCA_RATE, |
| 526 | TCA_FCNT, |
| 527 | TCA_STATS2, |
| 528 | TCA_STAB, |
| 529 | __TCA_MAX |
| 530 | }; |
| 531 | |
| 532 | #define TCA_MAX (__TCA_MAX - 1) |
| 533 | |
| 534 | #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) |
| 535 | #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) |
| 536 | |
| 537 | /******************************************************************** |
| 538 | * Neighbor Discovery userland options |
| 539 | ****/ |
| 540 | |
| 541 | struct nduseroptmsg { |
| 542 | unsigned char nduseropt_family; |
| 543 | unsigned char nduseropt_pad1; |
| 544 | unsigned short nduseropt_opts_len; /* Total length of options */ |
| 545 | int nduseropt_ifindex; |
| 546 | __u8 nduseropt_icmp_type; |
| 547 | __u8 nduseropt_icmp_code; |
| 548 | unsigned short nduseropt_pad2; |
| 549 | unsigned int nduseropt_pad3; |
| 550 | /* Followed by one or more ND options */ |
| 551 | }; |
| 552 | |
| 553 | enum { |
| 554 | NDUSEROPT_UNSPEC, |
| 555 | NDUSEROPT_SRCADDR, |
| 556 | __NDUSEROPT_MAX |
| 557 | }; |
| 558 | |
| 559 | #define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) |
| 560 | |
| 561 | #ifndef __KERNEL__ |
| 562 | /* RTnetlink multicast groups - backwards compatibility for userspace */ |
| 563 | #define RTMGRP_LINK 1 |
| 564 | #define RTMGRP_NOTIFY 2 |
| 565 | #define RTMGRP_NEIGH 4 |
| 566 | #define RTMGRP_TC 8 |
| 567 | |
| 568 | #define RTMGRP_IPV4_IFADDR 0x10 |
| 569 | #define RTMGRP_IPV4_MROUTE 0x20 |
| 570 | #define RTMGRP_IPV4_ROUTE 0x40 |
| 571 | #define RTMGRP_IPV4_RULE 0x80 |
| 572 | |
| 573 | #define RTMGRP_IPV6_IFADDR 0x100 |
| 574 | #define RTMGRP_IPV6_MROUTE 0x200 |
| 575 | #define RTMGRP_IPV6_ROUTE 0x400 |
| 576 | #define RTMGRP_IPV6_IFINFO 0x800 |
| 577 | |
| 578 | #define RTMGRP_DECnet_IFADDR 0x1000 |
| 579 | #define RTMGRP_DECnet_ROUTE 0x4000 |
| 580 | |
| 581 | #define RTMGRP_IPV6_PREFIX 0x20000 |
| 582 | #endif |
| 583 | |
| 584 | /* RTnetlink multicast groups */ |
| 585 | enum rtnetlink_groups { |
| 586 | RTNLGRP_NONE, |
| 587 | #define RTNLGRP_NONE RTNLGRP_NONE |
| 588 | RTNLGRP_LINK, |
| 589 | #define RTNLGRP_LINK RTNLGRP_LINK |
| 590 | RTNLGRP_NOTIFY, |
| 591 | #define RTNLGRP_NOTIFY RTNLGRP_NOTIFY |
| 592 | RTNLGRP_NEIGH, |
| 593 | #define RTNLGRP_NEIGH RTNLGRP_NEIGH |
| 594 | RTNLGRP_TC, |
| 595 | #define RTNLGRP_TC RTNLGRP_TC |
| 596 | RTNLGRP_IPV4_IFADDR, |
| 597 | #define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR |
| 598 | RTNLGRP_IPV4_MROUTE, |
| 599 | #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE |
| 600 | RTNLGRP_IPV4_ROUTE, |
| 601 | #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE |
| 602 | RTNLGRP_IPV4_RULE, |
| 603 | #define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE |
| 604 | RTNLGRP_IPV6_IFADDR, |
| 605 | #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR |
| 606 | RTNLGRP_IPV6_MROUTE, |
| 607 | #define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE |
| 608 | RTNLGRP_IPV6_ROUTE, |
| 609 | #define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE |
| 610 | RTNLGRP_IPV6_IFINFO, |
| 611 | #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO |
| 612 | RTNLGRP_DECnet_IFADDR, |
| 613 | #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR |
| 614 | RTNLGRP_NOP2, |
| 615 | RTNLGRP_DECnet_ROUTE, |
| 616 | #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE |
| 617 | RTNLGRP_DECnet_RULE, |
| 618 | #define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE |
| 619 | RTNLGRP_NOP4, |
| 620 | RTNLGRP_IPV6_PREFIX, |
| 621 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX |
| 622 | RTNLGRP_IPV6_RULE, |
| 623 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE |
| 624 | RTNLGRP_ND_USEROPT, |
| 625 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT |
| 626 | RTNLGRP_PHONET_IFADDR, |
| 627 | #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR |
| 628 | RTNLGRP_PHONET_ROUTE, |
| 629 | #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE |
| 630 | RTNLGRP_DCB, |
| 631 | #define RTNLGRP_DCB RTNLGRP_DCB |
Nicolas Dichtel | edc9e74 | 2012-10-25 22:28:52 +0000 | [diff] [blame] | 632 | RTNLGRP_IPV4_NETCONF, |
| 633 | #define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF |
Nicolas Dichtel | f3a1bfb | 2012-10-25 22:28:50 +0000 | [diff] [blame] | 634 | RTNLGRP_IPV6_NETCONF, |
| 635 | #define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF |
Cong Wang | 37a393b | 2012-12-11 22:23:07 +0000 | [diff] [blame] | 636 | RTNLGRP_MDB, |
| 637 | #define RTNLGRP_MDB RTNLGRP_MDB |
Eric W. Biederman | 8de147d | 2015-03-03 19:14:31 -0600 | [diff] [blame] | 638 | RTNLGRP_MPLS_ROUTE, |
| 639 | #define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE |
Nicolas Dichtel | 9a96345 | 2015-04-07 11:51:53 +0200 | [diff] [blame] | 640 | RTNLGRP_NSID, |
| 641 | #define RTNLGRP_NSID RTNLGRP_NSID |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 642 | __RTNLGRP_MAX |
| 643 | }; |
| 644 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
| 645 | |
| 646 | /* TC action piece */ |
| 647 | struct tcamsg { |
| 648 | unsigned char tca_family; |
| 649 | unsigned char tca__pad1; |
| 650 | unsigned short tca__pad2; |
| 651 | }; |
| 652 | #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) |
| 653 | #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) |
| 654 | #define TCA_ACT_TAB 1 /* attr type must be >=1 */ |
| 655 | #define TCAA_MAX 1 |
| 656 | |
| 657 | /* New extended info filters for IFLA_EXT_MASK */ |
| 658 | #define RTEXT_FILTER_VF (1 << 0) |
Vlad Yasevich | 6cbdcee | 2013-02-13 12:00:13 +0000 | [diff] [blame] | 659 | #define RTEXT_FILTER_BRVLAN (1 << 1) |
Roopa Prabhu | 35a27ce | 2015-01-10 07:31:13 -0800 | [diff] [blame] | 660 | #define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 661 | |
| 662 | /* End of information exported to user level */ |
| 663 | |
| 664 | |
| 665 | |
| 666 | #endif /* _UAPI__LINUX_RTNETLINK_H */ |