Skip to contentSkip to conversation

bridge: accept bridge own MAC address as local

PATCH Ulrich Weber 3 participants 5 messages Aug 12, 2011 – Aug 26, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

---
 net/bridge/br_input.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/bridge/br_input.c +3 -1
index f06ee39..3adabe3 100644
@@ -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;
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 14 lines · On Fri, 12 Aug 2011 13:30:24 +0200 Ulrich Weber <[email protected]> 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.

---
 net/bridge/br_input.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/bridge/br_input.c +0 -0
index f06ee39..3adabe3 100644

net/bridge/br_input.c int br_handle_frame_finish(struct sk_buff *skb) · line 101

Quoted 10 lines
net/bridge/br_input.c +3 -1
@@ -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.

#2 lore raw
Quoted 3 lines · Stephen Hemminger

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

Signature · 3 lines
Ulrich Weber | [email protected] | Senior Software Engineer
Astaro - a Sophos company | Amalienbadstr 41 | 76227 Karlsruhe | Germany
Phone +49-721-25516-0 | Fax –200 | www.astaro.com
maintainer
#3 lore raw
In reply to Ulrich Weber

From: Ulrich Weber <[email protected]>
Date: Fri, 12 Aug 2011 13:30:24 +0200

Quoted 5 lines

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.

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.

#4 lore raw
Quoted 7 lines · On Fri, 26 Aug 2011 12:29:17 -0400 (EDT) David Miller <[email protected]>…

From: Ulrich Weber <[email protected]>
Date: Fri, 12 Aug 2011 13:30:24 +0200

Quoted 4 lines

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.

Quoted 8 lines
Quoted 1 line

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 [email protected]
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).