mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <geliangtang@gmail.com>
Subject: [MPTCP][PATCH v2 mptcp-next 09/10] selftests: mptcp: add fullmesh testcases
Date: Wed, 21 Jul 2021 22:31:33 +0800	[thread overview]
Message-ID: <b2634ea97c51cdad4f50dd10ef9b8b6dfb267f81.1626877655.git.geliangtang@gmail.com> (raw)
In-Reply-To: <66797ed318830e28cdbabf59011c0da39b9f6cce.1626877655.git.geliangtang@gmail.com>

This patch added the net device UP and DOWN testcases for the fullmesh
path manager.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 81 ++++++++++++++++++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 220154cb92a7..823300986459 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -160,6 +160,27 @@ reset_with_allow_join_id0()
 	ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable
 }
 
+reset_fullmesh()
+{
+	reset
+
+	ip netns exec $ns2 sysctl -q net.mptcp.fullmesh_enabled=1
+
+	for i in `seq 5 8`; do
+		ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2"
+		ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i
+		ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad
+		ip -net "$ns1" link set ns1eth$i up
+
+		ip -net "$ns2" addr add 10.0.$i.2/24 dev ns2eth$i
+		ip -net "$ns2" addr add dead:beef:$i::2/64 dev ns2eth$i nodad
+		ip -net "$ns2" link set ns2eth$i up
+
+		# let $ns2 reach any $ns1 address from any interface
+		ip -net "$ns2" route add default via 10.0.$i.1 dev ns2eth$i metric 10$i
+	done
+}
+
 ip -Version > /dev/null 2>&1
 if [ $? -ne 0 ];then
 	echo "SKIP: Could not run test without ip tool"
@@ -364,6 +385,16 @@ do_transfer()
 		elif [ $rm_nr_ns1 -eq 9 ]; then
 			sleep 1
 			ip netns exec ${listener_ns} ./pm_nl_ctl del 0 ${connect_addr}
+		elif [ $rm_nr_ns1 -eq 10 ]; then
+			local addr
+			local i=5
+			if is_v6 "${connect_addr}"; then
+				addr="dead:beef:$i::1/64"
+			else
+				addr="10.0.$i.1/24"
+			fi
+			sleep 2
+			ip -net "${listener_ns}" addr del $addr dev ns1eth$i
 		fi
 	fi
 
@@ -412,6 +443,16 @@ do_transfer()
 			fi
 			sleep 1
 			ip netns exec ${connector_ns} ./pm_nl_ctl del 0 $addr
+		elif [ $rm_nr_ns2 -eq 10 ]; then
+			local addr
+			local i=5
+			if is_v6 "${connect_addr}"; then
+				addr="dead:beef:$i::2/64"
+			else
+				addr="10.0.$i.2/24"
+			fi
+			sleep 2
+			ip -net "${connector_ns}" addr del $addr dev ns2eth$i
 		fi
 	fi
 
@@ -1683,6 +1724,39 @@ deny_join_id0_tests()
 	chk_join_nr "subflow and address allow join id0 2" 1 1 1
 }
 
+fullmesh_tests()
+{
+	# fullmesh add
+	reset_fullmesh
+	ip netns exec $ns1 ./pm_nl_ctl limits 8 8
+	ip netns exec $ns2 ./pm_nl_ctl limits 8 8
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+	chk_join_nr "fullmesh add" 4 4 4
+
+	# fullmesh add IPv6
+	reset_fullmesh
+	ip netns exec $ns1 ./pm_nl_ctl limits 8 8
+	ip netns exec $ns2 ./pm_nl_ctl limits 8 8
+	run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow
+	chk_join_nr "fullmesh add IPv6" 4 4 4
+
+	# fullmesh del
+	reset_fullmesh
+	ip netns exec $ns1 ./pm_nl_ctl limits 8 8
+	ip netns exec $ns2 ./pm_nl_ctl limits 8 8
+	run_tests $ns1 $ns2 10.0.1.1 0 0 -10 slow
+	chk_join_nr "fullmesh del" 4 4 4
+	chk_rm_nr 1 1
+
+	# fullmesh del IPv6
+	reset_fullmesh
+	ip netns exec $ns1 ./pm_nl_ctl limits 8 8
+	ip netns exec $ns2 ./pm_nl_ctl limits 8 8
+	run_tests $ns1 $ns2 dead:beef:1::1 0 0 -10 slow
+	chk_join_nr "fullmesh del IPv6" 4 4 4
+	chk_rm_nr 1 1
+}
+
 all_tests()
 {
 	subflows_tests
@@ -1698,6 +1772,7 @@ all_tests()
 	syncookies_tests
 	checksum_tests
 	deny_join_id0_tests
+	fullmesh_tests
 }
 
 usage()
@@ -1716,6 +1791,7 @@ usage()
 	echo "  -k syncookies_tests"
 	echo "  -S checksum_tests"
 	echo "  -d deny_join_id0_tests"
+	echo "  -m fullmesh_tests"
 	echo "  -c capture pcap files"
 	echo "  -C enable data checksum"
 	echo "  -h help"
@@ -1751,7 +1827,7 @@ if [ $do_all_tests -eq 1 ]; then
 	exit $ret
 fi
 
-while getopts 'fsltra64bpkdchCS' opt; do
+while getopts 'fsltra64bpkdmchCS' opt; do
 	case $opt in
 		f)
 			subflows_tests
@@ -1792,6 +1868,9 @@ while getopts 'fsltra64bpkdchCS' opt; do
 		d)
 			deny_join_id0_tests
 			;;
+		m)
+			fullmesh_tests
+			;;
 		c)
 			;;
 		C)
-- 
2.31.1


  reply	other threads:[~2021-07-21 14:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 14:31 [MPTCP][PATCH v2 mptcp-next 00/10] fullmesh path manager support Geliang Tang
2021-07-21 14:31 ` [MPTCP][PATCH v2 mptcp-next 01/10] mptcp: add a new sysctl fullmesh_enabled Geliang Tang
2021-07-21 14:31   ` [MPTCP][PATCH v2 mptcp-next 02/10] mptcp: register ipv4 addr notifier Geliang Tang
2021-07-21 14:31     ` [MPTCP][PATCH v2 mptcp-next 03/10] mptcp: register ipv6 " Geliang Tang
2021-07-21 14:31       ` [MPTCP][PATCH v2 mptcp-next 04/10] mptcp: add netdev up event handler Geliang Tang
2021-07-21 14:31         ` [MPTCP][PATCH v2 mptcp-next 05/10] mptcp: invoke mptcp_nl_remove_subflow_and_signal_addr in rcu_work Geliang Tang
2021-07-21 14:31           ` [MPTCP][PATCH v2 mptcp-next 06/10] mptcp: add netdev down event handler Geliang Tang
2021-07-21 14:31             ` [MPTCP][PATCH v2 mptcp-next 07/10] mptcp: add proc file local_addr_list Geliang Tang
2021-07-21 14:31               ` [MPTCP][PATCH v2 mptcp-next 08/10] selftests: mptcp: print the fullmesh flag Geliang Tang
2021-07-21 14:31                 ` Geliang Tang [this message]
2021-07-21 14:31                   ` [MPTCP][PATCH v2 mptcp-next 10/10] selftests: mptcp: del uncontinuous removing ids Geliang Tang
2021-07-22 13:34                     ` Matthieu Baerts
2021-07-22 13:33               ` [MPTCP][PATCH v2 mptcp-next 07/10] mptcp: add proc file local_addr_list Matthieu Baerts
2021-07-22 13:33         ` [MPTCP][PATCH v2 mptcp-next 04/10] mptcp: add netdev up event handler Matthieu Baerts
2021-07-21 17:08     ` [MPTCP][PATCH v2 mptcp-next 02/10] mptcp: register ipv4 addr notifier Paolo Abeni
2021-07-22 13:33       ` Matthieu Baerts
2021-07-22 13:33   ` [MPTCP][PATCH v2 mptcp-next 01/10] mptcp: add a new sysctl fullmesh_enabled Matthieu Baerts
2021-07-22 15:30 ` [MPTCP][PATCH v2 mptcp-next 00/10] fullmesh path manager support Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2634ea97c51cdad4f50dd10ef9b8b6dfb267f81.1626877655.git.geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=mptcp@lists.linux.dev \
    --subject='Re: [MPTCP][PATCH v2 mptcp-next 09/10] selftests: mptcp: add fullmesh testcases' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).