From: David Ahern <dsahern@gmail.com>
To: Geliang Tang <geliang.tang@suse.com>, netdev@vger.kernel.org
Cc: mptcp@lists.linux.dev, David Ahern <dsahern@kernel.org>,
Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: Re: [PATCH iproute2-next] mptcp: add id check for deleting address
Date: Sat, 15 Jan 2022 08:42:25 -0700 [thread overview]
Message-ID: <93dd20fc-e22e-2536-85f6-5442b3f19adc@gmail.com> (raw)
In-Reply-To: <0e01aafaba6df6ff7adf255999d64259d7ae8d50.1642204990.git.geliang.tang@suse.com>
On 1/14/22 5:10 PM, Geliang Tang wrote:
> This patch added the id check for deleting address in mptcp_parse_opt().
> The ADDRESS argument is invalid for the non-zero id address, only needed
> for the id 0 address.
>
> # ip mptcp endpoint delete id 1
> # ip mptcp endpoint delete id 0 10.0.1.1
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/171
meaning bug fix? If so please add a Fixes tag with the commit that
should have required the id.
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> ---
> ip/ipmptcp.c | 11 +++++++++--
> man/man8/ip-mptcp.8 | 16 +++++++++++++++-
> 2 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
> index e7150138..4363e753 100644
> --- a/ip/ipmptcp.c
> +++ b/ip/ipmptcp.c
> @@ -24,7 +24,7 @@ static void usage(void)
> fprintf(stderr,
> "Usage: ip mptcp endpoint add ADDRESS [ dev NAME ] [ id ID ]\n"
> " [ port NR ] [ FLAG-LIST ]\n"
> - " ip mptcp endpoint delete id ID\n"
> + " ip mptcp endpoint delete id ID [ ADDRESS ]\n"
> " ip mptcp endpoint change id ID [ backup | nobackup ]\n"
> " ip mptcp endpoint show [ id ID ]\n"
> " ip mptcp endpoint flush\n"
> @@ -103,6 +103,7 @@ static int get_flags(const char *arg, __u32 *flags)
> static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
> {
> bool adding = cmd == MPTCP_PM_CMD_ADD_ADDR;
> + bool deling = cmd == MPTCP_PM_CMD_DEL_ADDR;
> struct rtattr *attr_addr;
> bool addr_set = false;
> inet_prefix address;
> @@ -156,8 +157,14 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
> if (!addr_set && adding)
> missarg("ADDRESS");
>
> - if (!id_set && !adding)
> + if (!id_set && deling)
> missarg("ID");
> + else if (id_set && deling) {
brackets on the 'if () { .. }' since they are needed on the else.
> + if (id && addr_set)
> + invarg("invalid for non-zero id address\n", "ADDRESS");
> + else if (!id && !addr_set)
> + invarg("address is needed for deleting id 0 address\n", "ID");
> + }
>
> if (port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
> invarg("flags must have signal when using port", "port");
next prev parent reply other threads:[~2022-01-15 15:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-15 0:10 [PATCH iproute2-next] mptcp: add id check for deleting address Geliang Tang
2022-01-15 15:42 ` David Ahern [this message]
2022-01-19 6:08 ` Geliang Tang
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=93dd20fc-e22e-2536-85f6-5442b3f19adc@gmail.com \
--to=dsahern@gmail.com \
--cc=dsahern@kernel.org \
--cc=geliang.tang@suse.com \
--cc=mathew.j.martineau@linux.intel.com \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
/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 NNTP newsgroup(s).