selftests: mptcp: join: skip Fastclose tests if not supported

commit ae947bb2c2 upstream.

Selftests are supposed to run on any kernels, including the old ones not
supporting all MPTCP features.

One of them is the support of MP_FASTCLOSE introduced in commit
f284c0c773 ("mptcp: implement fastclose xmit path").

If the MIB counter is not available, the test cannot be verified and the
behaviour will not be the expected one. So we can skip the test if the
counter is missing.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: 01542c9bf9 ("selftests: mptcp: add fastclose testcase")
Cc: stable@vger.kernel.org
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Matthieu Baerts 2023-06-10 18:11:42 +02:00 committed by Greg Kroah-Hartman
parent 0381f30735
commit 695cce2f2c

View file

@ -253,6 +253,19 @@ reset()
return 0
}
# $1: test name ; $2: counter to check
reset_check_counter()
{
reset "${1}" || return 1
local counter="${2}"
if ! nstat -asz "${counter}" | grep -wq "${counter}"; then
mark_as_skipped "counter '${counter}' is not available"
return 1
fi
}
# $1: test name
reset_with_cookies()
{
@ -2959,14 +2972,14 @@ fullmesh_tests()
fastclose_tests()
{
if reset "fastclose test"; then
if reset_check_counter "fastclose test" "MPTcpExtMPFastcloseTx"; then
run_tests $ns1 $ns2 10.0.1.1 1024 0 fastclose_client
chk_join_nr 0 0 0
chk_fclose_nr 1 1
chk_rst_nr 1 1 invert
fi
if reset "fastclose server test"; then
if reset_check_counter "fastclose server test" "MPTcpExtMPFastcloseRx"; then
run_tests $ns1 $ns2 10.0.1.1 1024 0 fastclose_server
chk_join_nr 0 0 0
chk_fclose_nr 1 1 invert