Skip to content

Commit dd17a7f

Browse files
committed
Merge branch 'mptcp-only-inc-mpjoinackhmacfailure-for-hmac-failures'
Matthieu Baerts says: ==================== mptcp: only inc MPJoinAckHMacFailure for HMAC failures Recently, during a debugging session using local MPTCP connections, I noticed MPJoinAckHMacFailure was strangely not zero on the server side. The first patch fixes this issue -- present since v5.9 -- and the second one validates it in the selftests. ==================== Link: https://patch.msgid.link/20250407-net-mptcp-hmac-failure-mib-v1-0-3c9ecd0a3a50@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 445e99b + 6767698 commit dd17a7f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

net/mptcp/subflow.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,13 +899,17 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
899899
goto dispose_child;
900900
}
901901

902-
if (!subflow_hmac_valid(req, &mp_opt) ||
903-
!mptcp_can_accept_new_subflow(subflow_req->msk)) {
902+
if (!subflow_hmac_valid(req, &mp_opt)) {
904903
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
905904
subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
906905
goto dispose_child;
907906
}
908907

908+
if (!mptcp_can_accept_new_subflow(owner)) {
909+
subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
910+
goto dispose_child;
911+
}
912+
909913
/* move the msk reference ownership to the subflow */
910914
subflow_req->msk = NULL;
911915
ctx->conn = (struct sock *)owner;

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,15 @@ chk_join_nr()
14411441
fi
14421442
fi
14431443

1444+
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckHMacFailure")
1445+
if [ -z "$count" ]; then
1446+
rc=${KSFT_SKIP}
1447+
elif [ "$count" != "0" ]; then
1448+
rc=${KSFT_FAIL}
1449+
print_check "synack HMAC"
1450+
fail_test "got $count JOIN[s] synack HMAC failure expected 0"
1451+
fi
1452+
14441453
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx")
14451454
if [ -z "$count" ]; then
14461455
rc=${KSFT_SKIP}
@@ -1450,6 +1459,15 @@ chk_join_nr()
14501459
fail_test "got $count JOIN[s] ack rx expected $ack_nr"
14511460
fi
14521461

1462+
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckHMacFailure")
1463+
if [ -z "$count" ]; then
1464+
rc=${KSFT_SKIP}
1465+
elif [ "$count" != "0" ]; then
1466+
rc=${KSFT_FAIL}
1467+
print_check "ack HMAC"
1468+
fail_test "got $count JOIN[s] ack HMAC failure expected 0"
1469+
fi
1470+
14531471
print_results "join Rx" ${rc}
14541472

14551473
join_syn_tx="${join_syn_tx:-${syn_nr}}" \

0 commit comments

Comments
 (0)