diff options
author | Matt Johnston <matt@codeconstruct.com.au> | 2025-07-10 16:55:59 +0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2025-07-15 12:08:39 +0200 |
commit | 3549eb08e5505823857838b5cf5f08567702d054 (patch) | |
tree | 7ee13fd8d58056b4616ecb94d4b96ee31066fa09 /net/mctp/route.c | |
parent | 1aeed732f4f885ad36280ca4afb331fa42bf7263 (diff) |
net: mctp: Allow limiting binds to a peer address
Prior to calling bind() a program may call connect() on a socket to
restrict to a remote peer address.
Using connect() is the normal mechanism to specify a remote network
peer, so we use that here. In MCTP connect() is only used for bound
sockets - send() is not available for MCTP since a tag must be provided
for each message.
The smctp_type must match between connect() and bind() calls.
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Link: https://patch.msgid.link/20250710-mctp-bind-v4-6-8ec2f6460c56@codeconstruct.com.au
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/mctp/route.c')
-rw-r--r-- | net/mctp/route.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/mctp/route.c b/net/mctp/route.c index 69cfb0e6c545..2b2b958ef6a3 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -65,7 +65,11 @@ static struct mctp_sock *mctp_lookup_bind_details(struct net *net, if (msk->bind_type != type) continue; - if (!mctp_address_matches(msk->bind_addr, dest)) + if (msk->bind_peer_set && + !mctp_address_matches(msk->bind_peer_addr, src)) + continue; + + if (!mctp_address_matches(msk->bind_local_addr, dest)) continue; return msk; |