[PATCH mptcp-next 4/7] selftests: mptcp: add clear_flags in mptcp_join.sh

Geliang Tang posted 7 patches 4 months, 2 weeks ago
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Mat Martineau <mathew.j.martineau@linux.intel.com>, "David S. Miller" <davem@davemloft.net>
[PATCH mptcp-next 4/7] selftests: mptcp: add clear_flags in mptcp_join.sh
Posted by Geliang Tang 4 months, 2 weeks ago
This patch changed the command 'pm_nl_ctl set $addr flags nobackup' to
'pm_nl_ctl clear $addr flags backup', and renamed bkup to setflags.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index e48ce23d2386..7dbd36c558cd 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -289,7 +289,7 @@ do_transfer()
 	addr_nr_ns1="$7"
 	addr_nr_ns2="$8"
 	speed="$9"
-	bkup="${10}"
+	setflags="${10}"
 
 	port=$((10000+$TEST_COUNT))
 	TEST_COUNT=$((TEST_COUNT+1))
@@ -461,14 +461,20 @@ do_transfer()
 		fi
 	fi
 
-	if [ ! -z $bkup ]; then
+	if [ ! -z $setflags ]; then
 		sleep 1
 		for netns in "$ns1" "$ns2"; do
 			dump=(`ip netns exec $netns ./pm_nl_ctl dump`)
 			if [ ${#dump[@]} -gt 0 ]; then
 				addr=${dump[${#dump[@]} - 1]}
-				backup="ip netns exec $netns ./pm_nl_ctl set $addr flags $bkup"
-				$backup
+				if [ $setflags = "backup" ]; then
+					cmd=set
+					flags=backup
+				elif [ $setflags = "nobackup" ]; then
+					cmd=clear
+					flags=backup
+				fi
+				ip netns exec $netns ./pm_nl_ctl $cmd $addr flags $flags
 			fi
 		done
 	fi
@@ -545,7 +551,7 @@ run_tests()
 	addr_nr_ns1="${5:-0}"
 	addr_nr_ns2="${6:-0}"
 	speed="${7:-fast}"
-	bkup="${8:-""}"
+	setflags="${8:-""}"
 	lret=0
 	oldin=""
 
@@ -574,7 +580,7 @@ run_tests()
 	fi
 
 	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
-		${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${bkup}
+		${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${setflags}
 	lret=$?
 }
 
-- 
2.31.1