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