bridge: accept bridge own MAC address as local

Subsystems: ethernet bridge, networking [general], the rest

5 messages, 3 authors, 2011-08-26 · open the first message on its own page

bridge: accept bridge own MAC address as local

From: Ulrich Weber <hidden>
Date: 2011-08-12 11:36:06

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 <redacted>
---
 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

Re: bridge: accept bridge own MAC address as local

From: Stephen Hemminger <hidden>
Date: 2011-08-12 16:19:05

On Fri, 12 Aug 2011 13:30:24 +0200
Ulrich Weber [off-list ref] wrote:
quoted hunk
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 <redacted>
---
 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.

Re: bridge: accept bridge own MAC address as local

From: Ulrich Weber <hidden>
Date: 2011-08-12 16:42:31

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

Re: bridge: accept bridge own MAC address as local

From: David Miller <davem@davemloft.net>
Date: 2011-08-26 16:29:23

From: Ulrich Weber <redacted>
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 <redacted>
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.

Re: bridge: accept bridge own MAC address as local

From: Stephen Hemminger <hidden>
Date: 2011-08-26 16:42:32

On Fri, 26 Aug 2011 12:29:17 -0400 (EDT)
David Miller [off-list ref] wrote:
From: Ulrich Weber <redacted>
Date: Fri, 12 Aug 2011 13:30:24 +0200
quoted
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 <redacted>
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).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help