Commit 98dea4fd authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Jakub Kicinski
Browse files

selftests: mptcp: validate MPJoinRejected counter



The parent commit adds this new counter, incremented when receiving a
connection request, if the PM didn't allow the creation of new subflows.

Most of the time, it is then kept at 0, except when the PM limits cause
the receiver side to reject new MPJoin connections. This is the case in
the following tests:

 - single subflow, limited by server
 - multiple subflows, limited by server
 - subflows limited by server w cookies
 - userspace pm type rejects join
 - userspace pm type prevents mp_prio

Simply set join_syn_rej=1 when checking the MPJoin counters for these
tests.

Reviewed-by: default avatarGeliang Tang <geliang@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250413-net-next-mptcp-sched-mib-sft-misc-v2-6-0f83a4350150@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4ce7fb8d
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ unset sflags
unset fastclose
unset fullmesh
unset speed
unset join_syn_rej
unset join_csum_ns1
unset join_csum_ns2
unset join_fail_nr
@@ -1403,6 +1404,7 @@ chk_join_nr()
	local syn_nr=$1
	local syn_ack_nr=$2
	local ack_nr=$3
	local syn_rej=${join_syn_rej:-0}
	local csum_ns1=${join_csum_ns1:-0}
	local csum_ns2=${join_csum_ns2:-0}
	local fail_nr=${join_fail_nr:-0}
@@ -1468,6 +1470,15 @@ chk_join_nr()
		fail_test "got $count JOIN[s] ack HMAC failure expected 0"
	fi

	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinRejected")
	if [ -z "$count" ]; then
		rc=${KSFT_SKIP}
	elif [ "$count" != "$syn_rej" ]; then
		rc=${KSFT_FAIL}
		print_check "syn rejected"
		fail_test "got $count JOIN[s] syn rejected expected $syn_rej"
	fi

	print_results "join Rx" ${rc}

	join_syn_tx="${join_syn_tx:-${syn_nr}}" \
@@ -1963,6 +1974,7 @@ subflows_tests()
		pm_nl_set_limits $ns2 0 1
		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
		run_tests $ns1 $ns2 10.0.1.1
		join_syn_rej=1 \
			chk_join_nr 1 1 0
	fi

@@ -1992,6 +2004,7 @@ subflows_tests()
		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
		pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
		run_tests $ns1 $ns2 10.0.1.1
		join_syn_rej=1 \
			chk_join_nr 2 2 1
	fi

@@ -3061,6 +3074,7 @@ syncookies_tests()
		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
		pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
		run_tests $ns1 $ns2 10.0.1.1
		join_syn_rej=1 \
			chk_join_nr 2 1 1
	fi

@@ -3545,6 +3559,7 @@ userspace_tests()
		pm_nl_set_limits $ns2 1 1
		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
		run_tests $ns1 $ns2 10.0.1.1
		join_syn_rej=1 \
			chk_join_nr 1 1 0
	fi

@@ -3568,6 +3583,7 @@ userspace_tests()
		pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
		sflags=backup speed=slow \
			run_tests $ns1 $ns2 10.0.1.1
		join_syn_rej=1 \
			chk_join_nr 1 1 0
		chk_prio_nr 0 0 0 0
	fi