netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bridge: accept bridge own MAC address as local
@ 2011-08-12 11:30 Ulrich Weber
  2011-08-12 16:19 ` Stephen Hemminger
  2011-08-26 16:29 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Weber @ 2011-08-12 11:30 UTC (permalink / raw)
  To: davem; +Cc: netdev

bridge: accept bridge own MAC address as local
if MAC address of bridge is manually set (BR_SET_MAC_ADDR). Otherwise
only MAC addresses of bridge members will work if manually set.

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
---
 net/bridge/br_input.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f06ee39..3adabe3 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -93,7 +93,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
 			skb2 = skb;
 
 		br->dev->stats.multicast++;
-	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
+	} else if ((br->flags & BR_SET_MAC_ADDR &&
+		    !compare_ether_addr(br->bridge_id.addr, dest)) ||
+		   ((dst = __br_fdb_get(br, dest)) && dst->is_local)) {
 		skb2 = skb;
 		/* Do not forward the packet since it's local. */
 		skb = NULL;
-- 
1.7.4.1


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

* Re: bridge: accept bridge own MAC address as local
  2011-08-12 11:30 bridge: accept bridge own MAC address as local Ulrich Weber
@ 2011-08-12 16:19 ` Stephen Hemminger
  2011-08-12 16:36   ` Ulrich Weber
  2011-08-26 16:29 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2011-08-12 16:19 UTC (permalink / raw)
  To: Ulrich Weber; +Cc: davem, netdev

On Fri, 12 Aug 2011 13:30:24 +0200
Ulrich Weber <ulrich.weber@sophos.com> wrote:

> bridge: accept bridge own MAC address as local
> if MAC address of bridge is manually set (BR_SET_MAC_ADDR). Otherwise
> only MAC addresses of bridge members will work if manually set.
> 
> Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
> ---
>  net/bridge/br_input.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index f06ee39..3adabe3 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -93,7 +93,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
>  			skb2 = skb;
>  
>  		br->dev->stats.multicast++;
> -	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
> +	} else if ((br->flags & BR_SET_MAC_ADDR &&
> +		    !compare_ether_addr(br->bridge_id.addr, dest)) ||
> +		   ((dst = __br_fdb_get(br, dest)) && dst->is_local)) {
>  		skb2 = skb;
>  		/* Do not forward the packet since it's local. */
>  		skb = NULL;

A cleaner way to do this would be better to put a local entry
in the forwarding database when mac address is manually set.
Then there would not be special case code.

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

* Re: bridge: accept bridge own MAC address as local
  2011-08-12 16:19 ` Stephen Hemminger
@ 2011-08-12 16:36   ` Ulrich Weber
  0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weber @ 2011-08-12 16:36 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: davem, netdev

On 08/12/2011 06:19 PM, Stephen Hemminger wrote:
> A cleaner way to do this would be better to put a local entry
> in the forwarding database when mac address is manually set.
> Then there would not be special case code.

I agree, would be nicer to have it in the forwarding db.

However to which bridge port should i attach this entry?
Seems to be wrong for me to have it attached to a not
related port...

The intention of this patch is to set the bridge MAC to any
address, not related to an bridge port interface.

Cheers
 Ulrich

-- 
Ulrich Weber | ulrich.weber@sophos.com | Senior Software Engineer
Astaro - a Sophos company | Amalienbadstr 41 | 76227 Karlsruhe | Germany
Phone +49-721-25516-0 | Fax –200 | www.astaro.com

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

* Re: bridge: accept bridge own MAC address as local
  2011-08-12 11:30 bridge: accept bridge own MAC address as local Ulrich Weber
  2011-08-12 16:19 ` Stephen Hemminger
@ 2011-08-26 16:29 ` David Miller
  2011-08-26 16:42   ` Stephen Hemminger
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2011-08-26 16:29 UTC (permalink / raw)
  To: ulrich.weber; +Cc: netdev

From: Ulrich Weber <ulrich.weber@sophos.com>
Date: Fri, 12 Aug 2011 13:30:24 +0200

> bridge: accept bridge own MAC address as local
> if MAC address of bridge is manually set (BR_SET_MAC_ADDR). Otherwise
> only MAC addresses of bridge members will work if manually set.
> 
> Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>

As Stephen mentioned, the real bug is that we don't create a local
FDB entry (and get rid of the old one) when the MAC address changes.

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

* Re: bridge: accept bridge own MAC address as local
  2011-08-26 16:29 ` David Miller
@ 2011-08-26 16:42   ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2011-08-26 16:42 UTC (permalink / raw)
  To: David Miller; +Cc: ulrich.weber, netdev

On Fri, 26 Aug 2011 12:29:17 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:

> From: Ulrich Weber <ulrich.weber@sophos.com>
> Date: Fri, 12 Aug 2011 13:30:24 +0200
> 
> > bridge: accept bridge own MAC address as local
> > if MAC address of bridge is manually set (BR_SET_MAC_ADDR). Otherwise
> > only MAC addresses of bridge members will work if manually set.
> > 
> > Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
> 
> As Stephen mentioned, the real bug is that we don't create a local
> FDB entry (and get rid of the old one) when the MAC address changes.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Another alternative is going back to restricting the mac address of
the bridge to be the same as one of the existing ports. This was how
it used to be, but some people wanted to set arbitrary addresses
(probably to deal with start up ordering issues).

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

end of thread, other threads:[~2011-08-26 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 11:30 bridge: accept bridge own MAC address as local Ulrich Weber
2011-08-12 16:19 ` Stephen Hemminger
2011-08-12 16:36   ` Ulrich Weber
2011-08-26 16:29 ` David Miller
2011-08-26 16:42   ` Stephen Hemminger

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