This patch implemented a new function named pm_nl_set_endpoint(), 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 set the flags of the PM
endpoint.
Used this wrapper in all the selftests in mptcp_join.sh 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 | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ce36205f2e0a..9d1f1ffd822b 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -374,6 +374,19 @@ pm_nl_show_endpoint()
fi
}
+pm_nl_set_endpoint()
+{
+ local ns=$1
+ local addr=$2
+ local bkup=$3
+
+ if [ $ip_mptcp -eq 1 ]; then
+ ip -n $ns mptcp endpoint set $addr $bkup
+ else
+ ip netns exec $ns ./pm_nl_ctl set $addr flags $bkup
+ fi
+}
+
do_transfer()
{
listener_ns="$1"
@@ -580,7 +593,7 @@ do_transfer()
pos=0
fi
addr=${arr[$pos]}
- ip netns exec $netns ./pm_nl_ctl set $addr flags $bkup
+ pm_nl_set_endpoint $netns $addr $bkup
done
done
fi
--
2.31.1