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 do_transfer() instead of using the pm_nl_ctl command
directly.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 29 ++++++++++++++++---
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ec86ea9d57a8..16fb756e363e 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -376,6 +376,24 @@ pm_nl_show_endpoints()
fi
}
+pm_nl_change_endpoint()
+{
+ local ns=$1
+ local addr=$2
+ local id=$3
+ local flags=$4
+ local port=$5
+
+ if [ $ip_mptcp -eq 1 ]; then
+ ip -n $ns mptcp endpoint change id $id $flags
+ else
+ if [ $port -gt 0 ]; then
+ _port="port $port"
+ fi
+ ip netns exec $ns ./pm_nl_ctl set $addr flags $flags $_port
+ fi
+}
+
do_transfer()
{
listener_ns="$1"
@@ -577,6 +595,8 @@ do_transfer()
local arr=($line)
local addr
local port=0
+ local nr=0
+ local id
for i in ${arr[@]}; do
if is_addr $i; then
@@ -587,11 +607,12 @@ do_transfer()
port=$i
fi
fi
+ if [ $i = "id" ]; then
+ id=${arr[$nr+1]}
+ fi
+ let nr+=1
done
- if [ $port -gt 0 ]; then
- _port="port $port"
- fi
- ip netns exec $netns ./pm_nl_ctl set $addr flags $sflags $_port
+ pm_nl_change_endpoint $netns $addr $id $sflags $port
done
done
fi
--
2.31.1