Skip to content

Commit e73aab3

Browse files
matttbegregkh
authored andcommitted
selftests: mptcp: check subflow errors in close events
commit 2ef9e3a upstream. This validates the previous commit: subflow closed events should contain an error field when a subflow got closed with an error, e.g. reset or timeout. For this test, the chk_evt_nr helper has been extended to check attributes in the matched events. In this test, the 2 subflow closed events should have an error. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 15cc104 ("mptcp: deliver ssk errors to msk") Cc: stable@vger.kernel.org Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260127-net-mptcp-dup-nl-events-v1-4-7f71e1bc4feb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8d4ccc1 commit e73aab3

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,21 +3692,28 @@ userspace_pm_chk_get_addr()
36923692
fi
36933693
}
36943694

3695-
# $1: ns ; $2: event type ; $3: count
3695+
# $1: ns ; $2: event type ; $3: count ; [ $4: attr ; $5: attr count ]
36963696
chk_evt_nr()
36973697
{
36983698
local ns=${1}
36993699
local evt_name="${2}"
37003700
local exp="${3}"
3701+
local attr="${4}"
3702+
local attr_exp="${5}"
37013703

37023704
local evts="${evts_ns1}"
37033705
local evt="${!evt_name}"
3706+
local attr_name
37043707
local count
37053708

3709+
if [ -n "${attr}" ]; then
3710+
attr_name=", ${attr}: ${attr_exp}"
3711+
fi
3712+
37063713
evt_name="${evt_name:16}" # without MPTCP_LIB_EVENT_
37073714
[ "${ns}" == "ns2" ] && evts="${evts_ns2}"
37083715

3709-
print_check "event ${ns} ${evt_name} (${exp})"
3716+
print_check "event ${ns} ${evt_name} (${exp}${attr_name})"
37103717

37113718
if [[ "${evt_name}" = "LISTENER_"* ]] &&
37123719
! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then
@@ -3718,6 +3725,16 @@ chk_evt_nr()
37183725
if [ "${count}" != "${exp}" ]; then
37193726
fail_test "got ${count} events, expected ${exp}"
37203727
cat "${evts}"
3728+
return
3729+
elif [ -z "${attr}" ]; then
3730+
print_ok
3731+
return
3732+
fi
3733+
3734+
count=$(grep -w "type:${evt}" "${evts}" | grep -c ",${attr}:")
3735+
if [ "${count}" != "${attr_exp}" ]; then
3736+
fail_test "got ${count} event attributes, expected ${attr_exp}"
3737+
grep -w "type:${evt}" "${evts}"
37213738
else
37223739
print_ok
37233740
fi
@@ -3976,7 +3993,7 @@ userspace_tests()
39763993
chk_subflows_total 1 1
39773994
userspace_pm_add_sf $ns2 10.0.1.2 0
39783995
wait_event ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
3979-
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
3996+
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2 error 2
39803997
fi
39813998
kill_events_pids
39823999
mptcp_lib_kill_group_wait $tests_pid

0 commit comments

Comments
 (0)