diff mbox series

[mptcp-next,2/5] selftests: mptcp: validate MPJoin HMacFailure counters

Message ID 20250329-mptcp-mpj-reject-v1-2-2396d5666e8f@kernel.org (mailing list archive)
State Accepted
Commit f80f8ee1b1b7bef4d7044f2005398f9790968275
Delegated to: Matthieu Baerts
Headers show
Series mptcp: fix MPJoinAckHMacFailure, add MPJoinRejected | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
matttbe/shellcheck success No ShellCheck issues
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅

Commit Message

Matthieu Baerts March 29, 2025, 4:26 p.m. UTC
The parent commit fixes an issue around these counters where one of them
-- MPJoinAckHMacFailure -- was wrongly incremented in some cases.

This makes sure the counter is always 0. It should be incremented only
in case of corruption, or a wrong implementation, which should not be
the case in these selftests.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Note: this can go to mptcp-net as well, with the parent patch.
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Geliang Tang March 30, 2025, 12:15 a.m. UTC | #1
Hi Matt,

Thanks for this patch.

On Sat, 2025-03-29 at 17:26 +0100, Matthieu Baerts (NGI0) wrote:
> The parent commit fixes an issue around these counters where one of
> them
> -- MPJoinAckHMacFailure -- was wrongly incremented in some cases.
> 
> This makes sure the counter is always 0. It should be incremented
> only
> in case of corruption, or a wrong implementation, which should not be
> the case in these selftests.
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> Note: this can go to mptcp-net as well, with the parent patch.
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 18
> ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index
> 13a3b68181ee14eb628a858e5738094c3c936b74..5060b7e24f94550246c2b1f0465
> dcaf42b869313 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -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 "ack HMAC"

Should here be "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 "synack HMAC"

... and here be "ack HMAC"?

Thanks,
-Geliang

> +		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}}" \
>
Matthieu Baerts March 31, 2025, 12:31 p.m. UTC | #2
Hi Geliang,

On 30/03/2025 01:15, Geliang Tang wrote:
> 
> Hi Matt,
> 
> Thanks for this patch.
> 
> On Sat, 2025-03-29 at 17:26 +0100, Matthieu Baerts (NGI0) wrote:
>> The parent commit fixes an issue around these counters where one of
>> them
>> -- MPJoinAckHMacFailure -- was wrongly incremented in some cases.
>>
>> This makes sure the counter is always 0. It should be incremented
>> only
>> in case of corruption, or a wrong implementation, which should not be
>> the case in these selftests.
>>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
>> Note: this can go to mptcp-net as well, with the parent patch.
>> ---
>>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 18
>> ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> index
>> 13a3b68181ee14eb628a858e5738094c3c936b74..5060b7e24f94550246c2b1f0465
>> dcaf42b869313 100755
>> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> @@ -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 "ack HMAC"
> 
> Should here be "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 "synack HMAC"
> 
> ... and here be "ack HMAC"?

Good catch! I can fix that when applying the patches.

Cheers,
Matt
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 13a3b68181ee14eb628a858e5738094c3c936b74..5060b7e24f94550246c2b1f0465dcaf42b869313 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -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 "ack 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 "synack 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}}" \