MPTCP Archive mirror
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v3 08/12] selftests: mptcp: add change_address helper
Date: Mon, 18 Mar 2024 13:28:52 +0100	[thread overview]
Message-ID: <530cbf80-882b-4a73-94e2-6b70d7c38488@kernel.org> (raw)
In-Reply-To: <565780415a0be17de9118113b586cd49f841265a.1710636726.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 17/03/2024 01:58, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> The address that needs to change flags can only be identified by an address
> ID in change_endpoint() helper. This patch adds another helper named
> change_address(), its 2nd parameter is an IP address.
> 
> Usage:
> 	Address ID - change_endpoint $ns id $id $flags
> 	IP address - change_address $ns $addr $flags
> 
> Use this new helper in pm_netlink.sh to replace all 'pm_nl_ctl set'
> commands.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_lib.sh  | 13 +++++++++++++
>  tools/testing/selftests/net/mptcp/pm_netlink.sh |  4 ++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index d83a67922b17..e26ef67e4ef1 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -588,3 +588,16 @@ mptcp_lib_pm_nl_get_endpoint() {
>                 ip netns exec "${ns}" ./pm_nl_ctl get "${id}"
>         fi
>  }
> +
> +mptcp_lib_pm_nl_change_address() {

Same here, if it is only used in pm_netlink.sh, keep it there, with a
shorter name, and without ns:

  change_address 10.0.1.1 backup

no?

> +	local ns=${1}
> +	local addr=${2}
> +	local flags=${3}
> +
> +	if mptcp_lib_is_ip_mptcp; then
> +		# shellcheck disable=SC2086 # blanks in flags, no double quote
> +		ip -n "${ns}" mptcp endpoint change "${addr}" ${flags//","/" "}

It looks like this helper is only used with 'backup' or 'nobackup' flag,
you can then use "${flags}" without the "disable=SC2086", no?

> +	else
> +		ip netns exec "${ns}" ./pm_nl_ctl set "${addr}" flags "${flags}"
> +	fi
> +}
(...)

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2024-03-18 12:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  0:57 [PATCH mptcp-next v3 00/12] add helpers and vars in mptcp_lib.sh, final Geliang Tang
2024-03-17  0:58 ` [PATCH mptcp-net v3 01/12] selftests: mptcp: join: fix dev in check_endpoint Geliang Tang
2024-03-18 11:03   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 02/12] selftests: mptcp: export ip_mptcp to mptcp_lib Geliang Tang
2024-03-17  0:58 ` [PATCH mptcp-next v3 03/12] selftests: mptcp: format limits outputs Geliang Tang
2024-03-18 12:21   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 04/12] selftests: mptcp: add get_limits helper Geliang Tang
2024-03-18 12:22   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 05/12] selftests: mptcp: export set_limits helper Geliang Tang
2024-03-18 12:24   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 06/12] selftests: mptcp: format endpoints outputs Geliang Tang
2024-03-18 12:26   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 07/12] selftests: mptcp: add get_endpoint helper Geliang Tang
2024-03-18 12:27   ` Matthieu Baerts
2024-03-17  0:58 ` [PATCH mptcp-next v3 08/12] selftests: mptcp: add change_address helper Geliang Tang
2024-03-18 12:28   ` Matthieu Baerts [this message]
2024-03-17  0:58 ` [PATCH mptcp-next v3 09/12] selftests: mptcp: join: update endpoint ops Geliang Tang
2024-03-17  0:58 ` [PATCH mptcp-next v3 10/12] selftests: mptcp: export more " Geliang Tang
2024-03-17  0:58 ` [PATCH mptcp-next v3 11/12] selftests: mptcp: ip_mptcp option for more scripts Geliang Tang
2024-03-17  0:58 ` [PATCH mptcp-next v3 12/12] selftests: mptcp: netlink: drop disable=SC2086 Geliang Tang
2024-03-17  1:49 ` [PATCH mptcp-next v3 00/12] add helpers and vars in mptcp_lib.sh, final MPTCP CI
2024-03-18 12:20 ` 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=530cbf80-882b-4a73-94e2-6b70d7c38488@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).