netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v4 0/8] net: mctp: Improved bind handling
@ 2025-07-10  8:55 Matt Johnston
  2025-07-10  8:55 ` [PATCH net-next v4 1/8] net: mctp: mctp_test_route_extaddr_input cleanup Matt Johnston
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Matt Johnston @ 2025-07-10  8:55 UTC (permalink / raw)
  To: Jeremy Kerr, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: netdev, Matt Johnston

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.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
---
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/20250709-mctp-bind-v3-0-eac98bbf5e95@codeconstruct.com.au

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/20250707-mctp-bind-v2-0-fbaed8c1fb4d@codeconstruct.com.au

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/20250703-mctp-bind-v1-0-bb7e97c24613@codeconstruct.com.au

---
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,
-- 
Matt Johnston <matt@codeconstruct.com.au>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-07-15 11:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  8:55 [PATCH net-next v4 0/8] net: mctp: Improved bind handling Matt Johnston
2025-07-10  8:55 ` [PATCH net-next v4 1/8] net: mctp: mctp_test_route_extaddr_input cleanup Matt Johnston
2025-07-10  8:55 ` [PATCH net-next v4 2/8] net: mctp: Prevent duplicate binds Matt Johnston
2025-07-15  9:50   ` Paolo Abeni
2025-07-10  8:55 ` [PATCH net-next v4 3/8] net: mctp: Treat MCTP_NET_ANY specially in bind() Matt Johnston
2025-07-10  8:55 ` [PATCH net-next v4 4/8] net: mctp: Add test for conflicting bind()s Matt Johnston
2025-07-10  8:55 ` [PATCH net-next v4 5/8] net: mctp: Use hashtable for binds Matt Johnston
2025-07-15 10:05   ` Paolo Abeni
2025-07-15 11:08     ` Matt Johnston
2025-07-10  8:55 ` [PATCH net-next v4 6/8] net: mctp: Allow limiting binds to a peer address Matt Johnston
2025-07-10  8:56 ` [PATCH net-next v4 7/8] net: mctp: Test conflicts of connect() with bind() Matt Johnston
2025-07-10  8:56 ` [PATCH net-next v4 8/8] net: mctp: Add bind lookup test Matt Johnston
2025-07-15 10:20 ` [PATCH net-next v4 0/8] net: mctp: Improved bind handling patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).