Skip to content

net: mctp: Improved bind handling

Matt Johnston netdev 4 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 20250321-mctp-bind-e77968f180fd

Versions newest first

  1. v4 Latest8 patches 3 repliesApplied 8/8
  2. v38 patches 4 repliesSuperseded
  3. v27 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches4 repliesSuperseded

Changes in v4 from the cover letter

- Fix error path socket release in mctp_bind()
- Fix commit message Fixes: for mctp_test_route_extaddr_input
- Link to v3: https://lore.kernel.org/r/[email protected]

Patches in v4 All 8 applied

#Subject and filesSizeRepliesApplied
1/8net: mctp: mctp_test_route_extaddr_input cleanupnet/mctp/test/route-test.c+2 -40 repliesApplied
2/8net: mctp: Prevent duplicate bindsnet/mctp/af_mctp.c+24 -41 replyApplied
3/8net: mctp: Treat MCTP_NET_ANY specially in bind()net/mctp/af_mctp.c+15 -10 repliesApplied
4/8net: mctp: Add test for conflicting bind()snet/mctp/test/sock-test.c net/mctp/test/utils.c net/mctp/test/utils.h+162 -00 repliesApplied
5/8net: mctp: Use hashtable for bindsinclude/net/netns/mctp.h net/mctp/af_mctp.c net/mctp/route.c+87 -252 repliesApplied
6/8net: mctp: Allow limiting binds to a peer addressinclude/net/mctp.h net/mctp/af_mctp.c net/mctp/route.c+108 -80 repliesApplied
7/8net: mctp: Test conflicts of connect() with bind()net/mctp/test/sock-test.c net/mctp/test/utils.c net/mctp/test/utils.h+59 -40 repliesApplied
8/8net: mctp: Add bind lookup testnet/mctp/test/route-test.c net/mctp/test/utils.h+191 -00 repliesApplied

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH net-next v4 0/8] net: mctp: Improved bind handling

This series improves a couple of aspects of MCTP bind() handling.

MCTP wasn't checking whether the same MCTP type was bound by multiple sockets. That would result in messages being received by an arbitrary socket, which isn't useful behaviour. Instead it makes more sense to have the duplicate binds fail, the same as other network protocols. An exception is made for more-specific binds to particular MCTP addresses.

It is also useful to be able to limit a bind to only receive incoming request messages (MCTP TO bit set) from a specific peer+type, so that individual processes can communicate with separate MCTP peers. One example is a PLDM firmware update requester, which will initiate communication with a device, and then the device will connect back to the requester process.

These limited binds are implemented by a connect() call on the socket prior to bind. connect() isn't used in the general case for MCTP, since a plain send() wouldn't provide the required MCTP tag argument for addressing.

---
Changes in v4:
- Fix error path socket release in mctp_bind()
- Fix commit message Fixes: for mctp_test_route_extaddr_input
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Rebased to net-next
- kunit tests have been updated for MCTP gateway routing changes
- Bind conflict tests are now in the new mctp/tests/sock-test.c
- Added patch for mctp_test_route_extaddr_input kunit socket cleanup
(fixes MCTP gateway routing change in net-next, required by tests in
this series)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Use DECLARE_HASHTABLE
- Remove unused kunit test case
- Avoid kunit test snprintf truncation warning
- Fix lines >80 characters
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Matt Johnston (8):
net: mctp: mctp_test_route_extaddr_input cleanup
net: mctp: Prevent duplicate binds
net: mctp: Treat MCTP_NET_ANY specially in bind()
net: mctp: Add test for conflicting bind()s
net: mctp: Use hashtable for binds
net: mctp: Allow limiting binds to a peer address
net: mctp: Test conflicts of connect() with bind()
net: mctp: Add bind lookup test

 include/net/mctp.h         |   5 +-
 include/net/netns/mctp.h   |  20 ++++-
 net/mctp/af_mctp.c         | 148 +++++++++++++++++++++++++++++++---
 net/mctp/route.c           |  85 ++++++++++++++++----
 net/mctp/test/route-test.c | 194 ++++++++++++++++++++++++++++++++++++++++++++-
 net/mctp/test/sock-test.c  | 167 ++++++++++++++++++++++++++++++++++++++
 net/mctp/test/utils.c      |  36 +++++++++
 net/mctp/test/utils.h      |  17 ++++
 8 files changed, 637 insertions(+), 35 deletions(-)

---
base-commit: ea988b450690448d5b12ce743a598ade7a8c34b1
change-id: 20250321-mctp-bind-e77968f180fd

Best regards,

Signature · 1 line
Matt Johnston <[email protected]>