net: nexthop uapi
New UAPI for nexthops as standalone objects:
- defines netlink ancillary header, struct nhmsg
- RTM commands for nexthop objects, RTM_*NEXTHOP,
- RTNLGRP for nexthop notifications, RTNLGRP_NEXTHOP,
- Attributes for creating nexthops, NHA_*
- Attribute for route specs to specify a nexthop by id, RTA_NH_ID.
The nexthop attributes and semantics follow the route and RTA ones for
device, gateway and lwt encap. Unique to nexthop objects are a blackhole
and a group which contains references to other nexthop objects. With the
exception of blackhole and group, nexthop objects MUST contain a device.
Gateway and encap are optional. Nexthop groups can only reference other
pre-existing nexthops by id. If the NHA_ID attribute is present that id
is used for the nexthop. If not specified, one is auto assigned.
Dump requests can include attributes:
- NHA_GROUPS to return only nexthop groups,
- NHA_MASTER to limit dumps to nexthops with devices enslaved to the
given master (e.g., VRF)
- NHA_OIF to limit dumps to nexthops using given device
nlmsg_route_perms in selinux code is updated for the new RTM comands.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-25 05:43:03 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
|
|
#ifndef _UAPI_LINUX_NEXTHOP_H
|
|
|
|
#define _UAPI_LINUX_NEXTHOP_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct nhmsg {
|
|
|
|
unsigned char nh_family;
|
|
|
|
unsigned char nh_scope; /* return only */
|
|
|
|
unsigned char nh_protocol; /* Routing protocol that installed nh */
|
|
|
|
unsigned char resvd;
|
|
|
|
unsigned int nh_flags; /* RTNH_F flags */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* entry in a nexthop group */
|
|
|
|
struct nexthop_grp {
|
|
|
|
__u32 id; /* nexthop id - must exist */
|
|
|
|
__u8 weight; /* weight of this nexthop */
|
|
|
|
__u8 resvd1;
|
|
|
|
__u16 resvd2;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2021-03-12 02:03:15 +08:00
|
|
|
NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
|
|
|
|
* default type if not specified
|
|
|
|
*/
|
|
|
|
NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
|
net: nexthop uapi
New UAPI for nexthops as standalone objects:
- defines netlink ancillary header, struct nhmsg
- RTM commands for nexthop objects, RTM_*NEXTHOP,
- RTNLGRP for nexthop notifications, RTNLGRP_NEXTHOP,
- Attributes for creating nexthops, NHA_*
- Attribute for route specs to specify a nexthop by id, RTA_NH_ID.
The nexthop attributes and semantics follow the route and RTA ones for
device, gateway and lwt encap. Unique to nexthop objects are a blackhole
and a group which contains references to other nexthop objects. With the
exception of blackhole and group, nexthop objects MUST contain a device.
Gateway and encap are optional. Nexthop groups can only reference other
pre-existing nexthops by id. If the NHA_ID attribute is present that id
is used for the nexthop. If not specified, one is auto assigned.
Dump requests can include attributes:
- NHA_GROUPS to return only nexthop groups,
- NHA_MASTER to limit dumps to nexthops with devices enslaved to the
given master (e.g., VRF)
- NHA_OIF to limit dumps to nexthops using given device
nlmsg_route_perms in selinux code is updated for the new RTM comands.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-25 05:43:03 +08:00
|
|
|
__NEXTHOP_GRP_TYPE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NHA_UNSPEC,
|
|
|
|
NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */
|
|
|
|
|
|
|
|
NHA_GROUP, /* array of nexthop_grp */
|
|
|
|
NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */
|
|
|
|
/* if NHA_GROUP attribute is added, no other attributes can be set */
|
|
|
|
|
|
|
|
NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */
|
|
|
|
/* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */
|
|
|
|
|
|
|
|
NHA_OIF, /* u32; nexthop device */
|
|
|
|
NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */
|
|
|
|
NHA_ENCAP_TYPE, /* u16; lwt encap type */
|
|
|
|
NHA_ENCAP, /* lwt encap data */
|
|
|
|
|
|
|
|
/* NHA_OIF can be appended to dump request to return only
|
|
|
|
* nexthops using given device
|
|
|
|
*/
|
|
|
|
NHA_GROUPS, /* flag; only return nexthop groups in dump */
|
|
|
|
NHA_MASTER, /* u32; only return nexthops with given master dev */
|
|
|
|
|
2020-05-22 13:26:13 +08:00
|
|
|
NHA_FDB, /* flag; nexthop belongs to a bridge fdb */
|
|
|
|
/* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
|
|
|
|
|
2021-03-12 02:03:15 +08:00
|
|
|
/* nested; resilient nexthop group attributes */
|
|
|
|
NHA_RES_GROUP,
|
|
|
|
/* nested; nexthop bucket attributes */
|
|
|
|
NHA_RES_BUCKET,
|
|
|
|
|
net: nexthop uapi
New UAPI for nexthops as standalone objects:
- defines netlink ancillary header, struct nhmsg
- RTM commands for nexthop objects, RTM_*NEXTHOP,
- RTNLGRP for nexthop notifications, RTNLGRP_NEXTHOP,
- Attributes for creating nexthops, NHA_*
- Attribute for route specs to specify a nexthop by id, RTA_NH_ID.
The nexthop attributes and semantics follow the route and RTA ones for
device, gateway and lwt encap. Unique to nexthop objects are a blackhole
and a group which contains references to other nexthop objects. With the
exception of blackhole and group, nexthop objects MUST contain a device.
Gateway and encap are optional. Nexthop groups can only reference other
pre-existing nexthops by id. If the NHA_ID attribute is present that id
is used for the nexthop. If not specified, one is auto assigned.
Dump requests can include attributes:
- NHA_GROUPS to return only nexthop groups,
- NHA_MASTER to limit dumps to nexthops with devices enslaved to the
given master (e.g., VRF)
- NHA_OIF to limit dumps to nexthops using given device
nlmsg_route_perms in selinux code is updated for the new RTM comands.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-25 05:43:03 +08:00
|
|
|
__NHA_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NHA_MAX (__NHA_MAX - 1)
|
2021-03-12 02:03:15 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
NHA_RES_GROUP_UNSPEC,
|
|
|
|
/* Pad attribute for 64-bit alignment. */
|
|
|
|
NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
|
|
|
|
|
|
|
|
/* u16; number of nexthop buckets in a resilient nexthop group */
|
|
|
|
NHA_RES_GROUP_BUCKETS,
|
|
|
|
/* clock_t as u32; nexthop bucket idle timer (per-group) */
|
|
|
|
NHA_RES_GROUP_IDLE_TIMER,
|
|
|
|
/* clock_t as u32; nexthop unbalanced timer */
|
|
|
|
NHA_RES_GROUP_UNBALANCED_TIMER,
|
|
|
|
/* clock_t as u64; nexthop unbalanced time */
|
|
|
|
NHA_RES_GROUP_UNBALANCED_TIME,
|
|
|
|
|
|
|
|
__NHA_RES_GROUP_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NHA_RES_BUCKET_UNSPEC,
|
|
|
|
/* Pad attribute for 64-bit alignment. */
|
|
|
|
NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
|
|
|
|
|
|
|
|
/* u16; nexthop bucket index */
|
|
|
|
NHA_RES_BUCKET_INDEX,
|
|
|
|
/* clock_t as u64; nexthop bucket idle time */
|
|
|
|
NHA_RES_BUCKET_IDLE_TIME,
|
|
|
|
/* u32; nexthop id assigned to the nexthop bucket */
|
|
|
|
NHA_RES_BUCKET_NH_ID,
|
|
|
|
|
|
|
|
__NHA_RES_BUCKET_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)
|
|
|
|
|
net: nexthop uapi
New UAPI for nexthops as standalone objects:
- defines netlink ancillary header, struct nhmsg
- RTM commands for nexthop objects, RTM_*NEXTHOP,
- RTNLGRP for nexthop notifications, RTNLGRP_NEXTHOP,
- Attributes for creating nexthops, NHA_*
- Attribute for route specs to specify a nexthop by id, RTA_NH_ID.
The nexthop attributes and semantics follow the route and RTA ones for
device, gateway and lwt encap. Unique to nexthop objects are a blackhole
and a group which contains references to other nexthop objects. With the
exception of blackhole and group, nexthop objects MUST contain a device.
Gateway and encap are optional. Nexthop groups can only reference other
pre-existing nexthops by id. If the NHA_ID attribute is present that id
is used for the nexthop. If not specified, one is auto assigned.
Dump requests can include attributes:
- NHA_GROUPS to return only nexthop groups,
- NHA_MASTER to limit dumps to nexthops with devices enslaved to the
given master (e.g., VRF)
- NHA_OIF to limit dumps to nexthops using given device
nlmsg_route_perms in selinux code is updated for the new RTM comands.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-25 05:43:03 +08:00
|
|
|
#endif
|