Commit dd17a7f1 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarJakub Kicinski <kuba@kernel.org>
parents 445e99bd 6767698c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -899,13 +899,17 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
				goto dispose_child;
			}

			if (!subflow_hmac_valid(req, &mp_opt) ||
			    !mptcp_can_accept_new_subflow(subflow_req->msk)) {
			if (!subflow_hmac_valid(req, &mp_opt)) {
				SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
				subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
				goto dispose_child;
			}

			if (!mptcp_can_accept_new_subflow(owner)) {
				subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
				goto dispose_child;
			}

			/* move the msk reference ownership to the subflow */
			subflow_req->msk = NULL;
			ctx->conn = (struct sock *)owner;
+18 −0
Original line number Diff line number Diff line
@@ -1441,6 +1441,15 @@ chk_join_nr()
		fi
	fi

	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckHMacFailure")
	if [ -z "$count" ]; then
		rc=${KSFT_SKIP}
	elif [ "$count" != "0" ]; then
		rc=${KSFT_FAIL}
		print_check "synack HMAC"
		fail_test "got $count JOIN[s] synack HMAC failure expected 0"
	fi

	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx")
	if [ -z "$count" ]; then
		rc=${KSFT_SKIP}
@@ -1450,6 +1459,15 @@ chk_join_nr()
		fail_test "got $count JOIN[s] ack rx expected $ack_nr"
	fi

	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckHMacFailure")
	if [ -z "$count" ]; then
		rc=${KSFT_SKIP}
	elif [ "$count" != "0" ]; then
		rc=${KSFT_FAIL}
		print_check "ack HMAC"
		fail_test "got $count JOIN[s] ack HMAC failure expected 0"
	fi

	print_results "join Rx" ${rc}

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