This patch implemented a new function named pm_nl_show_endpoints(), wraped
the PM netlink commands 'ip mptcp' and 'pm_nl_ctl' in it, and used a new
argument 'ip_mptcp' to choose which one to use to show all the PM
endpoints.
Used this wrapper in do_transfer() instead of using the pm_nl_ctl commands
directly.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 086e0778a1fa..66f430d6300f 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -360,6 +360,17 @@ pm_nl_flush_endpoint()
fi
}
+pm_nl_show_endpoints()
+{
+ local ns=$1
+
+ if [ $ip_mptcp -eq 1 ]; then
+ ip -n $ns mptcp endpoint show
+ else
+ ip netns exec $ns ./pm_nl_ctl dump
+ fi
+}
+
do_transfer()
{
listener_ns="$1"
@@ -468,7 +479,7 @@ do_transfer()
let rm_nr_ns1=-addr_nr_ns1
if [ $rm_nr_ns1 -lt 8 ]; then
counter=0
- ip netns exec ${listener_ns} ./pm_nl_ctl dump | while read line; do
+ pm_nl_show_endpoints ${listener_ns} | while read line; do
local arr=($line)
local nr=0
@@ -521,7 +532,7 @@ do_transfer()
let rm_nr_ns2=-addr_nr_ns2
if [ $rm_nr_ns2 -lt 8 ]; then
counter=0
- ip netns exec ${connector_ns} ./pm_nl_ctl dump | while read line; do
+ pm_nl_show_endpoints ${connector_ns} | while read line; do
local arr=($line)
local nr=0
@@ -557,7 +568,7 @@ do_transfer()
if [ ! -z $sflags ]; then
sleep 1
for netns in "$ns1" "$ns2"; do
- ip netns exec $netns ./pm_nl_ctl dump | while read line; do
+ pm_nl_show_endpoints $netns | while read line; do
local arr=($line)
local addr
--
2.31.1