Netdev List
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: Ido Schimmel <idosch@nvidia.com>, netdev@vger.kernel.org
Cc: dsahern@gmail.com, stephen@networkplumber.org, mlxsw@nvidia.com
Subject: Re: [PATCH iproute2-next 1/6] bridge: mdb: Use a boolean to indicate nest is required
Date: Fri, 16 Dec 2022 13:59:18 +0200	[thread overview]
Message-ID: <680da65d-a8a4-5809-6d9a-62ee05ff86b6@blackwall.org> (raw)
In-Reply-To: <20221215175230.1907938-2-idosch@nvidia.com>

On 15/12/2022 19:52, Ido Schimmel wrote:
> Currently, the only attribute inside the 'MDBA_SET_ENTRY_ATTRS' nest is
> 'MDBE_ATTR_SOURCE', but subsequent patches are going to add more
> attributes to the nest.
> 
> Prepare for the addition of these attributes by determining the
> necessity of the nest from a boolean variable that is set whenever one
> of these attributes is parsed. This avoids the need to have one long
> condition that checks for the presence of one of the individual
> attributes.
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  bridge/mdb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/bridge/mdb.c b/bridge/mdb.c
> index d3afc900e798..4ae91f15dac8 100644
> --- a/bridge/mdb.c
> +++ b/bridge/mdb.c
> @@ -488,6 +488,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
>  	};
>  	char *d = NULL, *p = NULL, *grp = NULL, *src = NULL;
>  	struct br_mdb_entry entry = {};
> +	bool set_attrs = false;
>  	short vid = 0;
>  
>  	while (argc > 0) {
> @@ -511,6 +512,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
>  		} else if (strcmp(*argv, "src") == 0) {
>  			NEXT_ARG();
>  			src = *argv;
> +			set_attrs = true;
>  		} else {
>  			if (matches(*argv, "help") == 0)
>  				usage();
> @@ -538,7 +540,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
>  
>  	entry.vid = vid;
>  	addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry));
> -	if (src) {
> +	if (set_attrs) {
>  		struct rtattr *nest = addattr_nest(&req.n, sizeof(req),
>  						   MDBA_SET_ENTRY_ATTRS);
>  		struct in6_addr src_ip6;

Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>


  reply	other threads:[~2022-12-16 12:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 17:52 [PATCH iproute2-next 0/6] bridge: mdb: Add support for new attributes Ido Schimmel
2022-12-15 17:52 ` [PATCH iproute2-next 1/6] bridge: mdb: Use a boolean to indicate nest is required Ido Schimmel
2022-12-16 11:59   ` Nikolay Aleksandrov [this message]
2022-12-15 17:52 ` [PATCH iproute2-next 2/6] bridge: mdb: Split source parsing to a separate function Ido Schimmel
2022-12-16 11:59   ` Nikolay Aleksandrov
2022-12-15 17:52 ` [PATCH iproute2-next 3/6] bridge: mdb: Add filter mode support Ido Schimmel
2022-12-16 12:00   ` Nikolay Aleksandrov
2022-12-15 17:52 ` [PATCH iproute2-next 4/6] bridge: mdb: Add source list support Ido Schimmel
2022-12-16 12:05   ` Nikolay Aleksandrov
2022-12-15 17:52 ` [PATCH iproute2-next 5/6] bridge: mdb: Add routing protocol support Ido Schimmel
2022-12-16 12:06   ` Nikolay Aleksandrov
2022-12-15 17:52 ` [PATCH iproute2-next 6/6] bridge: mdb: Add replace support Ido Schimmel
2022-12-16 12:06   ` Nikolay Aleksandrov
2022-12-19  1:50 ` [PATCH iproute2-next 0/6] bridge: mdb: Add support for new attributes patchwork-bot+netdevbpf

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=680da65d-a8a4-5809-6d9a-62ee05ff86b6@blackwall.org \
    --to=razor@blackwall.org \
    --cc=dsahern@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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