Skip to content

net: mctp: Add support for gateway routing

Jeremy Kerr netdev 5 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected] change-id 20250520-dev-forwarding-0711973470bf

Versions newest first

  1. v5 Latest14 patches 0 repliesApplied 14/14
  2. v414 patches 4 repliesSuperseded
  3. v314 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v213 patches0 repliesSuperseded
v113 patches2 repliesSuperseded

Changes in v5 from the cover letter

- reinstate IFF_LOOPBACK check for new routes. Reported by Paolo Abeni
- mctp_sendmsg: return immediately on errors before we have allocated
skb, preventing a mctp_dst_release() on uninit dst. Reported by Paolo
Abeni.
- move mctp_dev_hold() to nlparse_populate, so we're consistent in the
cleanup semantics. defer all stores to @rt to the success case.
- keep existing semantics of extaddr->halen checking
- Link to v4: https://lore.kernel.org/r/[email protected]

Patches in v5 All 14 applied

#Subject and filesSizeRepliesApplied
1/14net: mctp: don't use source cb data when forwarding, ensure pkt_type is setnet/mctp/route.c+12 -10 repliesApplied
2/14net: mctp: test: make cloned_frag buffers more appropriately-sizednet/mctp/test/route-test.c+3 -50 repliesApplied
3/14net: mctp: separate routing database from routing operationsinclude/net/mctp.h net/mctp/af_mctp.c net/mctp/route.c +1 more+313 -2390 repliesApplied
4/14net: mctp: separate cb from direct-addressing routinginclude/net/mctp.h net/mctp/route.c+7 -180 repliesApplied
5/14net: mctp: test: Add an addressed device constructornet/mctp/test/utils.c net/mctp/test/utils.h+25 -20 repliesApplied
6/14net: mctp: test: Add extaddr routing output testnet/mctp/test/route-test.c+53 -00 repliesApplied
7/14net: mctp: test: move functions into utils.[ch]net/mctp/test/route-test.c net/mctp/test/utils.c net/mctp/test/utils.h+182 -1630 repliesApplied
8/14net: mctp: test: add sock test infrastructurenet/mctp/af_mctp.c net/mctp/test/route-test.c net/mctp/test/sock-test.c+21 -10 repliesApplied
9/14net: mctp: test: Add initial socket testsnet/mctp/route.c net/mctp/test/sock-test.c+218 -00 repliesApplied
10/14net: mctp: pass net into route creationnet/mctp/route.c+16 -150 repliesApplied
11/14net: mctp: remove routes by netid, not by devicenet/mctp/route.c+10 -40 repliesApplied
12/14net: mctp: allow NL parsing directly into a struct mctp_routenet/mctp/route.c+140 -620 repliesApplied
13/14net: mctp: add gateway routing supportinclude/net/mctp.h include/uapi/linux/mctp.h net/mctp/route.c +1 more+173 -570 repliesApplied
14/14net: mctp: test: Add tests for gateway routesnet/mctp/test/route-test.c net/mctp/test/sock-test.c net/mctp/test/utils.c +1 more+271 -100 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH net-next v5 00/14] net: mctp: Add support for gateway routing

This series adds a gateway route type for the MCTP core, allowing non-local EIDs as the match for a route.

Example setup using the mctp tools:

mctp route add 9 via mctpi2c0
mctp neigh add 9 dev mctpi2c0 lladdr 0x1d
mctp route add 10 gw 9

- will route packets to eid 10 through mctpi2c0, using a dest lladdr of 0x1d (ie, that of the directly-attached eid 9).

The core change to support this is the introduction of a struct mctp_dst, which represents the result of a route lookup. Since this involves a bit of surgery through the routing code, we add a few tests along the way.

We're introducing an ABI change in the new RTM_{NEW,GET,DEL}ROUTE netlink formats, with the support for a RTA_GATEWAY attribute. Because we need a network ID specified to fully-qualify a gateway EID, the RTA_GATEWAY attribute carries the (net, eid) tuple in full:

    struct mctp_fq_addr {
        unsigned int net;
        mctp_eid_t eid;
    }

Of course, any questions, comments etc are most welcome.

---
Changes in v5:
- reinstate IFF_LOOPBACK check for new routes. Reported by Paolo Abeni
- mctp_sendmsg: return immediately on errors before we have allocated
skb, preventing a mctp_dst_release() on uninit dst. Reported by Paolo
Abeni.
- move mctp_dev_hold() to nlparse_populate, so we're consistent in the
cleanup semantics. defer all stores to @rt to the success case.
- keep existing semantics of extaddr->halen checking
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- avoid vla detection from const array-size initialiser, reported by ktr
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- 02/14 (new): Reduce frame size for route_input_cloned_frag kunit test,
preventing -Wframe-size-larger-than warnings
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- 12/13: prevent uninitialsed gateway variable in nlparse_common
- 13/13: make test data static
- commit message spelling fixes
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jeremy Kerr (14):
net: mctp: don't use source cb data when forwarding, ensure pkt_type is set
net: mctp: test: make cloned_frag buffers more appropriately-sized
net: mctp: separate routing database from routing operations
net: mctp: separate cb from direct-addressing routing
net: mctp: test: Add an addressed device constructor
net: mctp: test: Add extaddr routing output test
net: mctp: test: move functions into utils.[ch]
net: mctp: test: add sock test infrastructure
net: mctp: test: Add initial socket tests
net: mctp: pass net into route creation
net: mctp: remove routes by netid, not by device
net: mctp: allow NL parsing directly into a struct mctp_route
net: mctp: add gateway routing support
net: mctp: test: Add tests for gateway routes

 include/net/mctp.h         |  52 +++-
 include/uapi/linux/mctp.h  |   8 +
 net/mctp/af_mctp.c         |  66 ++---
 net/mctp/route.c           | 574 ++++++++++++++++++++++++++++--------------
 net/mctp/test/route-test.c | 612 +++++++++++++++++++++++++++++----------------
 net/mctp/test/sock-test.c  | 229 +++++++++++++++++
 net/mctp/test/utils.c      | 196 ++++++++++++++-
 net/mctp/test/utils.h      |  44 ++++
 8 files changed, 1324 insertions(+), 457 deletions(-)

---
base-commit: 0097c4195b1d0ca57d15979626c769c74747b5a0
change-id: 20250520-dev-forwarding-0711973470bf

Best regards,

Signature · 1 line
Jeremy Kerr <[email protected]>