All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: roopa@cumulusnetworks.com, davem@davemloft.net,
	stephen@networkplumber.org, netdev@vger.kernel.org
Cc: jhs@mojatatu.com, wkok@cumulusnetworks.com,
	sfeldma@cumulusnetworks.com, shm@cumulusnetworks.com
Subject: Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
Date: Wed, 28 May 2014 16:00:17 -0400	[thread overview]
Message-ID: <53864051.4070102@gmail.com> (raw)
In-Reply-To: <1401255611-30862-1-git-send-email-roopa@cumulusnetworks.com>

On 05/28/2014 01:40 AM, roopa@cumulusnetworks.com wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> 
> (This patch depends on net-next patch titled
> "Add bridge ifindex to bridge fdb notify msgs")
> 
> This patch adds master dev name from NDA_MASTER netlink attribute
>  to bridge fdb show output
> 
> current iproute2 tries to print 'master' in the output if NTF_MASTER
> is present. But, kernel today does not set NTF_MASTER during dump
> requests. Which means I have not seen iproute2 bridge cmd print 'master' atall.
> This patch overrides the NTF_MASTER flag if NDA_MASTER attribute is present.
> 
> Example output:
> 
> before this patch:
> # bridge fdb show
> 44:38:39:00:27:ba dev bond2.2003 permanent
> 44:38:39:00:27:bb dev bond4.2003 permanent
> 44:38:39:00:27:bc dev bond2.2004 permanent
> 
> After this patch:
> # bridge fdb show
> 44:38:39:00:27:ba dev bond2.2003 master br-2003 permanent
> 44:38:39:00:27:bb dev bond4.2003 master br-2003 permanent
> 44:38:39:00:27:bc dev bond2.2004 master br-2004 permanent

'master' is already a reserved word in the bridge command and
has a slightly different connotation. May be replace it with
'bridge' or something similar.

> 
> For comparision with the above, below is the output for NTF_SELF today,
> # bridge fdb show
> 33:33:00:00:00:01 dev eth0 self permanent
> 01:00:5e:00:00:01 dev eth0 self permanent
> 33:33:ff:00:01:cc dev eth0 self permanent
> 
> If change in output is a concern, 'master' can be put at the end of the fdb
> output line or made optional with -d[etails] option.

As Stephen always mentions, iproute commands have to be invertable.
In other words, what you get out of the show command you should
be able to feed back into a set command.

As such, it would probably be a good thing to support
bridge fdb set 44:38:39:00:27:ba dev bond2.2003 bridge br-2003 permanent

and I think this ends up being something very close to what
Jamal already proposed.

May be work together and come up with a single syntax.

-vlad


> 
> Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
>  bridge/fdb.c              |    5 ++++-
>  include/linux/neighbour.h |    1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/bridge/fdb.c b/bridge/fdb.c
> index 9b720e3..d1c3da6 100644
> --- a/bridge/fdb.c
> +++ b/bridge/fdb.c
> @@ -146,7 +146,10 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>  	}
>  	if (r->ndm_flags & NTF_SELF)
>  		fprintf(fp, "self ");
> -	if (r->ndm_flags & NTF_MASTER)
> +	if (tb[NDA_MASTER])
> +		fprintf(fp, "master %s ",
> +			ll_index_to_name(rta_getattr_u32(tb[NDA_MASTER])));
> +	else if (r->ndm_flags & NTF_MASTER)
>  		fprintf(fp, "master ");
>  	if (r->ndm_flags & NTF_ROUTER)
>  		fprintf(fp, "router ");
> diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
> index d3ef583..4a1d7e9 100644
> --- a/include/linux/neighbour.h
> +++ b/include/linux/neighbour.h
> @@ -24,6 +24,7 @@ enum {
>  	NDA_PORT,
>  	NDA_VNI,
>  	NDA_IFINDEX,
> +	NDA_MASTER,
>  	__NDA_MAX
>  };
>  
> 

  reply	other threads:[~2014-05-28 20:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28  5:40 [PATCH iproute2] bridge: Add master device name to bridge fdb show roopa
2014-05-28 20:00 ` Vlad Yasevich [this message]
2014-05-29  1:53   ` Roopa Prabhu
2014-05-30 14:36     ` Stephen Hemminger
2014-05-31  4:27       ` Roopa Prabhu
2014-05-31 11:10         ` Jamal Hadi Salim

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=53864051.4070102@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=sfeldma@cumulusnetworks.com \
    --cc=shm@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    --cc=wkok@cumulusnetworks.com \
    /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.