1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _UAPI_LINUX_NEXTHOP_H 3 #define _UAPI_LINUX_NEXTHOP_H 4 5 #include <linux/types.h> 6 7 struct nhmsg { 8 unsigned char nh_family; 9 unsigned char nh_scope; /* return only */ 10 unsigned char nh_protocol; /* Routing protocol that installed nh */ 11 unsigned char resvd; 12 unsigned int nh_flags; /* RTNH_F flags */ 13 }; 14 15 /* entry in a nexthop group */ 16 struct nexthop_grp { 17 __u32 id; /* nexthop id - must exist */ 18 __u8 weight; /* weight of this nexthop */ 19 __u8 resvd1; 20 __u16 resvd2; 21 }; 22 23 enum { 24 NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group 25 * default type if not specified 26 */ 27 NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */ 28 __NEXTHOP_GRP_TYPE_MAX, 29 }; 30 31 #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1) 32 33 enum { 34 NHA_UNSPEC, 35 NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */ 36 37 NHA_GROUP, /* array of nexthop_grp */ 38 NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */ 39 /* if NHA_GROUP attribute is added, no other attributes can be set */ 40 41 NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */ 42 /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */ 43 44 NHA_OIF, /* u32; nexthop device */ 45 NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */ 46 NHA_ENCAP_TYPE, /* u16; lwt encap type */ 47 NHA_ENCAP, /* lwt encap data */ 48 49 /* NHA_OIF can be appended to dump request to return only 50 * nexthops using given device 51 */ 52 NHA_GROUPS, /* flag; only return nexthop groups in dump */ 53 NHA_MASTER, /* u32; only return nexthops with given master dev */ 54 55 NHA_FDB, /* flag; nexthop belongs to a bridge fdb */ 56 /* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */ 57 58 /* nested; resilient nexthop group attributes */ 59 NHA_RES_GROUP, 60 /* nested; nexthop bucket attributes */ 61 NHA_RES_BUCKET, 62 63 __NHA_MAX, 64 }; 65 66 #define NHA_MAX (__NHA_MAX - 1) 67 68 enum { 69 NHA_RES_GROUP_UNSPEC, 70 /* Pad attribute for 64-bit alignment. */ 71 NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC, 72 73 /* u16; number of nexthop buckets in a resilient nexthop group */ 74 NHA_RES_GROUP_BUCKETS, 75 /* clock_t as u32; nexthop bucket idle timer (per-group) */ 76 NHA_RES_GROUP_IDLE_TIMER, 77 /* clock_t as u32; nexthop unbalanced timer */ 78 NHA_RES_GROUP_UNBALANCED_TIMER, 79 /* clock_t as u64; nexthop unbalanced time */ 80 NHA_RES_GROUP_UNBALANCED_TIME, 81 82 __NHA_RES_GROUP_MAX, 83 }; 84 85 #define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1) 86 87 enum { 88 NHA_RES_BUCKET_UNSPEC, 89 /* Pad attribute for 64-bit alignment. */ 90 NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC, 91 92 /* u16; nexthop bucket index */ 93 NHA_RES_BUCKET_INDEX, 94 /* clock_t as u64; nexthop bucket idle time */ 95 NHA_RES_BUCKET_IDLE_TIME, 96 /* u32; nexthop id assigned to the nexthop bucket */ 97 NHA_RES_BUCKET_NH_ID, 98 99 __NHA_RES_BUCKET_MAX, 100 }; 101 102 #define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1) 103 104 #endif 105