Message ID | 20220208094617.3675511-5-jk@codeconstruct.com.au (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | MCTP tag control interface | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 4 this patch: 4 |
netdev/cc_maintainers | success | CCed 5 of 5 maintainers |
netdev/build_clang | success | Errors and warnings before: 18 this patch: 18 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 9 this patch: 9 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 30 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
diff --git a/net/mctp/route.c b/net/mctp/route.c index 654467a7aeae..35f72e99e188 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -76,7 +76,7 @@ static struct mctp_sock *mctp_lookup_bind(struct net *net, struct sk_buff *skb) static bool mctp_key_match(struct mctp_sk_key *key, mctp_eid_t local, mctp_eid_t peer, u8 tag) { - if (key->local_addr != local) + if (!mctp_address_matches(key->local_addr, local)) return false; if (key->peer_addr != peer) @@ -616,7 +616,7 @@ static struct mctp_sk_key *mctp_alloc_local_tag(struct mctp_sock *msk, continue; if (!(mctp_address_matches(tmp->peer_addr, daddr) && - tmp->local_addr == saddr)) + mctp_address_matches(tmp->local_addr, saddr))) continue; spin_lock(&tmp->lock); diff --git a/net/mctp/test/route-test.c b/net/mctp/test/route-test.c index 044d59e81f89..5496e3a7f4c3 100644 --- a/net/mctp/test/route-test.c +++ b/net/mctp/test/route-test.c @@ -646,6 +646,14 @@ static const struct mctp_route_input_sk_keys_test mctp_route_input_sk_keys_tests .hdr = RX_HDR(1, 11, 8, FL_S | FL_E | FL_T(1)), .deliver = true, }, + { + .name = "any local match", + .key_peer_addr = 12, + .key_local_addr = MCTP_ADDR_ANY, + .key_tag = 1, + .hdr = RX_HDR(1, 12, 8, FL_S | FL_E | FL_T(1)), + .deliver = true, + }, }; static void mctp_route_input_sk_keys_to_desc(
Currently, we require an exact match on an incoming packet's dest address, and the key's local_addr field. In a future change, we may want to set up a key before packets are routed, meaning we have no local address to match on. This change allows key lookups to match on local_addr = MCTP_ADDR_ANY. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> --- net/mctp/route.c | 4 ++-- net/mctp/test/route-test.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)