Skip to content

Commit

Permalink
selftests: mptcp: userspace pm get addr tests
Browse files Browse the repository at this point in the history
This patch adds a new helper userspace_pm_get_addr() in mptcp_join.sh.
In it, parse the token value from the output of 'pm_nl_ctl events', then
pass it to pm_nl_ctl get_addr command. Use this helper in userspace pm
dump tests.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Dec 19, 2023
1 parent 62cf717 commit 36d135a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3372,6 +3372,18 @@ userspace_pm_dump()
ip netns exec $1 ./pm_nl_ctl dump token $tk
}

# $1: ns ; $2: id
userspace_pm_get_addr()
{
local evts=$evts_ns1
local tk

[ "$1" == "$ns2" ] && evts=$evts_ns2
tk=$(mptcp_lib_evts_get_info token "$evts")

ip netns exec $1 ./pm_nl_ctl get $2 token $tk
}

check_output()
{
local cmd="$1"
Expand Down Expand Up @@ -3602,6 +3614,8 @@ userspace_tests()
chk_subflows_total 2 2
chk_mptcp_info add_addr_signal 1 add_addr_accepted 1
local dump="id 10 flags signal 10.0.2.1"
check_output "userspace_pm_get_addr $ns1 10" \
"$dump" " get id 10 addr"
check_output "userspace_pm_dump $ns1" \
"$dump" " dump addrs signal"
kill_events_pids
Expand All @@ -3624,6 +3638,8 @@ userspace_tests()
chk_mptcp_info subflows 1 subflows 1
chk_subflows_total 2 2
local dump="id 20 flags subflow 10.0.3.2"
check_output "userspace_pm_get_addr $ns2 20" \
"$dump" " get id 20 addr"
check_output "userspace_pm_dump $ns2" \
"$dump" " dump addrs subflow"
kill_events_pids
Expand Down

0 comments on commit 36d135a

Please sign in to comment.