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 Feb 16, 2024
1 parent 62e45a7 commit faf3ecc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,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 @@ -3482,6 +3494,14 @@ userspace_tests()
$'id 10 flags signal 10.0.2.1\nid 20 flags signal 10.0.3.1' \
" dump addrs signal"
fi
if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then
check_output "userspace_pm_get_addr $ns1 10" \
"id 10 flags signal 10.0.2.1" \
" get id 10 addr"
check_output "userspace_pm_get_addr $ns1 20" \
"id 20 flags signal 10.0.3.1" \
" get id 20 addr"
fi
userspace_pm_rm_addr $ns1 10
userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED
if mptcp_lib_kallsyms_has "mptcp_userspace_pm_dump_addr$"; then
Expand Down Expand Up @@ -3520,6 +3540,11 @@ userspace_tests()
"id 20 flags subflow 10.0.3.2" \
" dump addrs subflow"
fi
if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then
check_output "userspace_pm_get_addr $ns2 20" \
"id 20 flags subflow 10.0.3.2" \
" get id 20 addr"
fi
userspace_pm_rm_addr $ns2 20
userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED
if mptcp_lib_kallsyms_has "mptcp_userspace_pm_dump_addr$"; then
Expand Down

0 comments on commit faf3ecc

Please sign in to comment.