summaryrefslogtreecommitdiff
path: root/include/net/mctp.h
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2025-07-02 14:20:13 +0800
committerPaolo Abeni <pabeni@redhat.com>2025-07-08 12:39:24 +0200
commitad39c12fcee34b8980a80ad5c803bca9906fbd4e (patch)
tree04175b4b2a82e46cccb30145637c3677e7de710f /include/net/mctp.h
parent28ddbb2abe13776d3835f4bda535edd46336870a (diff)
net: mctp: add gateway routing support
This change allows for gateway routing, where a route table entry may reference a routable endpoint (by network and EID), instead of routing directly to a netdevice. We add support for a RTM_GATEWAY attribute for netlink route updates, with an attribute format of: struct mctp_fq_addr { unsigned int net; mctp_eid_t eid; } - we need the net here to uniquely identify the target EID, as we no longer have the device reference directly (which would provide the net id in the case of direct routes). This makes route lookups recursive, as a route lookup that returns a gateway route must be resolved into a direct route (ie, to a device) eventually. We provide a limit to the route lookups, to prevent infinite loop routing. The route lookup populates a new 'nexthop' field in the dst structure, which now specifies the key for the neighbour table lookup on device output, rather than using the packet destination address directly. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Link: https://patch.msgid.link/20250702-dev-forwarding-v5-13-1468191da8a4@codeconstruct.com.au Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net/mctp.h')
-rw-r--r--include/net/mctp.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/net/mctp.h b/include/net/mctp.h
index b3af0690f607..ac4f4ecdfc24 100644
--- a/include/net/mctp.h
+++ b/include/net/mctp.h
@@ -237,8 +237,18 @@ struct mctp_route {
mctp_eid_t min, max;
unsigned char type;
+
unsigned int mtu;
- struct mctp_dev *dev;
+
+ enum {
+ MCTP_ROUTE_DIRECT,
+ MCTP_ROUTE_GATEWAY,
+ } dst_type;
+ union {
+ struct mctp_dev *dev;
+ struct mctp_fq_addr gateway;
+ };
+
int (*output)(struct mctp_dst *dst,
struct sk_buff *skb);
@@ -256,6 +266,7 @@ struct mctp_route {
struct mctp_dst {
struct mctp_dev *dev;
unsigned int mtu;
+ mctp_eid_t nexthop;
/* set for direct addressing */
unsigned char halen;