Skip to content

Commit 2ef9e3a

Browse files
matttbekuba-moo
authored andcommitted
selftests: mptcp: check subflow errors in close events
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>
1 parent dccf461 commit 2ef9e3a

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
@@ -3847,21 +3847,28 @@ userspace_pm_chk_get_addr()
38473847
fi
38483848
}
38493849

3850-
# $1: ns ; $2: event type ; $3: count
3850+
# $1: ns ; $2: event type ; $3: count ; [ $4: attr ; $5: attr count ]
38513851
chk_evt_nr()
38523852
{
38533853
local ns=${1}
38543854
local evt_name="${2}"
38553855
local exp="${3}"
3856+
local attr="${4}"
3857+
local attr_exp="${5}"
38563858

38573859
local evts="${evts_ns1}"
38583860
local evt="${!evt_name}"
3861+
local attr_name
38593862
local count
38603863

3864+
if [ -n "${attr}" ]; then
3865+
attr_name=", ${attr}: ${attr_exp}"
3866+
fi
3867+
38613868
evt_name="${evt_name:16}" # without MPTCP_LIB_EVENT_
38623869
[ "${ns}" == "ns2" ] && evts="${evts_ns2}"
38633870

3864-
print_check "event ${ns} ${evt_name} (${exp})"
3871+
print_check "event ${ns} ${evt_name} (${exp}${attr_name})"
38653872

38663873
if [[ "${evt_name}" = "LISTENER_"* ]] &&
38673874
! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then
@@ -3873,6 +3880,16 @@ chk_evt_nr()
38733880
if [ "${count}" != "${exp}" ]; then
38743881
fail_test "got ${count} events, expected ${exp}"
38753882
cat "${evts}"
3883+
return
3884+
elif [ -z "${attr}" ]; then
3885+
print_ok
3886+
return
3887+
fi
3888+
3889+
count=$(grep -w "type:${evt}" "${evts}" | grep -c ",${attr}:")
3890+
if [ "${count}" != "${attr_exp}" ]; then
3891+
fail_test "got ${count} event attributes, expected ${attr_exp}"
3892+
grep -w "type:${evt}" "${evts}"
38763893
else
38773894
print_ok
38783895
fi
@@ -4131,7 +4148,7 @@ userspace_tests()
41314148
chk_subflows_total 1 1
41324149
userspace_pm_add_sf $ns2 10.0.1.2 0
41334150
wait_event ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
4134-
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
4151+
chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2 error 2
41354152
fi
41364153
kill_events_pids
41374154
mptcp_lib_kill_group_wait $tests_pid

0 commit comments

Comments
 (0)