All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliang.tang@suse.com>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <geliang.tang@suse.com>
Subject: [PATCH mptcp-next v5 3/5] selftests: mptcp: add wrapper for showing addrs
Date: Thu, 13 Jan 2022 23:08:37 +0800	[thread overview]
Message-ID: <0b33d984c614b3ef3fa29056c3187ea9ef7fdda1.1642086296.git.geliang.tang@suse.com> (raw)
In-Reply-To: <cover.1642086296.git.geliang.tang@suse.com>

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 9150007fec30..06b1a3823bb4 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -365,6 +365,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"
@@ -473,7 +484,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
 
@@ -526,7 +537,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
 
@@ -562,7 +573,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
 				local port=0
-- 
2.31.1


  parent reply	other threads:[~2022-01-13 15:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 15:08 [PATCH mptcp-next v2 0/3] set_flags port support Geliang Tang
2022-01-13 15:08 ` [PATCH mptcp-next v2 1/3] mptcp: allow to use port and non-signal in set_flags Geliang Tang
2022-01-13 15:08 ` [PATCH mptcp-next v2 2/3] selftests: mptcp: add the port argument for set_flags Geliang Tang
2022-01-13 15:08 ` [PATCH mptcp-next v2 3/3] selftests: mptcp: add backup with port testcase Geliang Tang
2022-01-14  1:13   ` Mat Martineau
2022-01-13 15:08 ` [PATCH mptcp-next v5 0/5] use 'ip mptcp' in selftests Geliang Tang
2022-01-13 15:08   ` [PATCH mptcp-next v5 1/5] selftests: mptcp: add ip mptcp wrappers Geliang Tang
2022-01-13 15:08   ` [PATCH mptcp-next v5 2/5] selftests: mptcp: new approach of getting ID Geliang Tang
2022-01-13 15:08   ` Geliang Tang [this message]
2022-01-13 15:08   ` [PATCH mptcp-next v5 4/5] selftests: mptcp: add wrapper for setting flags Geliang Tang
2022-01-14  1:22     ` Mat Martineau
2022-01-13 15:08   ` [PATCH mptcp-next v5 5/5] selftests: mptcp: set ip_mptcp in command line Geliang Tang
2022-01-14  1:27   ` [PATCH mptcp-next v5 0/5] use 'ip mptcp' in selftests Mat Martineau

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=0b33d984c614b3ef3fa29056c3187ea9ef7fdda1.1642086296.git.geliang.tang@suse.com \
    --to=geliang.tang@suse.com \
    --cc=mptcp@lists.linux.dev \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.