netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] bridge: Add master device name to bridge fdb show
@ 2014-05-28  5:40 roopa
  2014-05-28 20:00 ` Vlad Yasevich
  0 siblings, 1 reply; 6+ messages in thread
From: roopa @ 2014-05-28  5:40 UTC (permalink / raw)
  To: davem, stephen, netdev; +Cc: jhs, wkok, sfeldma, shm

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

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.

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
 };
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
  2014-05-28  5:40 [PATCH iproute2] bridge: Add master device name to bridge fdb show roopa
@ 2014-05-28 20:00 ` Vlad Yasevich
  2014-05-29  1:53   ` Roopa Prabhu
  0 siblings, 1 reply; 6+ messages in thread
From: Vlad Yasevich @ 2014-05-28 20:00 UTC (permalink / raw)
  To: roopa, davem, stephen, netdev; +Cc: jhs, wkok, sfeldma, shm

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
>  };
>  
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
  2014-05-28 20:00 ` Vlad Yasevich
@ 2014-05-29  1:53   ` Roopa Prabhu
  2014-05-30 14:36     ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Roopa Prabhu @ 2014-05-29  1:53 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: davem, stephen, netdev, jhs, wkok, sfeldma, shm

On 5/28/14, 1:00 PM, Vlad Yasevich wrote:
> 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.
I am not so convinced about the 'bridge' keyword. The way i see it is: I 
am just adding more context to the existing 'master' keyword. In the 
cases i am pointing out above 'master' is a bridge.
If the only argument is that it changes existing output, ...i agree. I 
have expressed slight concerns about that before.
>
>> 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
We did discuss this on the other thread (RFC), and it does not seem 
necessary.
two things:
- like i indicated above, introducing 'bridge' to mean  'master' seems 
to add more confusion and
seems redundant. But, maybe that's just me.
- having user specify master when kernel can derive it
seems unnecessary (agree that for code symmetry we could add master 
during sets but make it optional)

>
> 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.
Ack.
looking at jamals patch for fdb show filters,  if i consider my approach 
of using 'master' to represent a bridge,
his syntax would look like,

bridge fdb {show} [dev DEV]
bridge fdb {show} [dev DEV] [master BRDEV]

Thanks,
Roopa

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
  2014-05-29  1:53   ` Roopa Prabhu
@ 2014-05-30 14:36     ` Stephen Hemminger
  2014-05-31  4:27       ` Roopa Prabhu
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2014-05-30 14:36 UTC (permalink / raw)
  To: Roopa Prabhu; +Cc: Vlad Yasevich, davem, netdev, jhs, wkok, sfeldma, shm

On Wed, 28 May 2014 18:53:36 -0700
Roopa Prabhu <roopa@cumulusnetworks.com> wrote:

> On 5/28/14, 1:00 PM, Vlad Yasevich wrote:
> > 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.
> I am not so convinced about the 'bridge' keyword. The way i see it is: I 
> am just adding more context to the existing 'master' keyword. In the 
> cases i am pointing out above 'master' is a bridge.
> If the only argument is that it changes existing output, ...i agree. I 
> have expressed slight concerns about that before.
> >
> >> 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
> We did discuss this on the other thread (RFC), and it does not seem 
> necessary.
> two things:
> - like i indicated above, introducing 'bridge' to mean  'master' seems 
> to add more confusion and
> seems redundant. But, maybe that's just me.
> - having user specify master when kernel can derive it
> seems unnecessary (agree that for code symmetry we could add master 
> during sets but make it optional)
> 
> >
> > 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.
> Ack.
> looking at jamals patch for fdb show filters,  if i consider my approach 
> of using 'master' to represent a bridge,
> his syntax would look like,
> 
> bridge fdb {show} [dev DEV]
> bridge fdb {show} [dev DEV] [master BRDEV]

I prefer bridge keyword since master is not used in IEEE 802
documents.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
  2014-05-30 14:36     ` Stephen Hemminger
@ 2014-05-31  4:27       ` Roopa Prabhu
  2014-05-31 11:10         ` Jamal Hadi Salim
  0 siblings, 1 reply; 6+ messages in thread
From: Roopa Prabhu @ 2014-05-31  4:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Vlad Yasevich, davem, netdev, jhs, wkok, sfeldma, shm

On 5/30/14, 7:36 AM, Stephen Hemminger wrote:
> On Wed, 28 May 2014 18:53:36 -0700
> Roopa Prabhu <roopa@cumulusnetworks.com> wrote:
>
>> On 5/28/14, 1:00 PM, Vlad Yasevich wrote:
>>> 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.
>> I am not so convinced about the 'bridge' keyword. The way i see it is: I
>> am just adding more context to the existing 'master' keyword. In the
>> cases i am pointing out above 'master' is a bridge.
>> If the only argument is that it changes existing output, ...i agree. I
>> have expressed slight concerns about that before.
>>>> 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
>> We did discuss this on the other thread (RFC), and it does not seem
>> necessary.
>> two things:
>> - like i indicated above, introducing 'bridge' to mean  'master' seems
>> to add more confusion and
>> seems redundant. But, maybe that's just me.
>> - having user specify master when kernel can derive it
>> seems unnecessary (agree that for code symmetry we could add master
>> during sets but make it optional)
>>
>>> 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.
>> Ack.
>> looking at jamals patch for fdb show filters,  if i consider my approach
>> of using 'master' to represent a bridge,
>> his syntax would look like,
>>
>> bridge fdb {show} [dev DEV]
>> bridge fdb {show} [dev DEV] [master BRDEV]
> I prefer bridge keyword since master is not used in IEEE 802
> documents.
but set also uses 'master' ..and the bridge is referenced using 'master' 
in almost all commands
#ip link set dev brport master brdev

so, using 'bridge' and 'master' interchangeably seems a bit confusing.

But, if  the preference is 'bridge' i will resubmit this patch with 
'bridge' shortly.

Thanks!.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] bridge: Add master device name to bridge fdb show
  2014-05-31  4:27       ` Roopa Prabhu
@ 2014-05-31 11:10         ` Jamal Hadi Salim
  0 siblings, 0 replies; 6+ messages in thread
From: Jamal Hadi Salim @ 2014-05-31 11:10 UTC (permalink / raw)
  To: Roopa Prabhu, Stephen Hemminger
  Cc: Vlad Yasevich, davem, netdev, wkok, sfeldma, shm

On 05/31/14 00:27, Roopa Prabhu wrote:
> On 5/30/14, 7:36 AM, Stephen Hemminger wrote:

> but set also uses 'master' ..and the bridge is referenced using 'master'
> in almost all commands
> #ip link set dev brport master brdev
>
> so, using 'bridge' and 'master' interchangeably seems a bit confusing.
>
> But, if  the preference is 'bridge' i will resubmit this patch with
> 'bridge' shortly.

Sorry - I guess until i looked at the code again last few minutes,
it had skipped my mind that this interface is also used for vxlan. So 
master now seems to make more sense ;->

Vlad, you may get your wish - it seems if i am going to have to set
the bridge device as a filter I will have no choice but to use an
ifm since it is size different from ndm. Which is not a big deal
until i attach an attribute - which breaks old iproute2  out in
the wild already. I have to say i am not liking this (because i was
hoping to add other filters in the future, example vlan)
but dont see a way out.
So the only way this would work is to use the original ifm as
the header.

cheers,
jamal

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-31 11:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-28  5:40 [PATCH iproute2] bridge: Add master device name to bridge fdb show roopa
2014-05-28 20:00 ` Vlad Yasevich
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

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).