summaryrefslogtreecommitdiff
path: root/cleopatre/linux-2.6.25.10-spc300/net
diff options
context:
space:
mode:
authorJean-Philippe SAVE2010-08-27 14:14:13 +0200
committerJean-Philippe SAVE2010-09-02 09:05:01 +0200
commit58b711fbb2943b0b83e9088a2b1fb6ca6108a5ea (patch)
treeaf0e8317e5e090028fbaf3e378f24cf69e4713ef /cleopatre/linux-2.6.25.10-spc300/net
parente5cd19d20d29b71f806e44c8cc10132f7f8aac1f (diff)
cleo/linux/net/bridge: Force bridge MAC addr to be plc0 MAC addr, closes #1839
Diffstat (limited to 'cleopatre/linux-2.6.25.10-spc300/net')
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/net/bridge/br_stp_if.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_stp_if.c b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_stp_if.c
index 1a430eccec..d57eba699c 100644
--- a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_stp_if.c
+++ b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_stp_if.c
@@ -216,13 +216,44 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
const unsigned char *addr = br_mac_zero;
struct net_bridge_port *p;
+#ifdef CONFIG_ARCH_SPC300
+ /* If plc0 interface exists use its MAC addr for bridge MAC addr */
+ list_for_each_entry(p, &br->port_list, list) {
+ if (strcmp(p->dev->name, "plc0") == 0) {
+ addr = p->dev->dev_addr;
+ break;
+ }
+ }
+
+ /* If plc0 interface doesn't exist try to find some other
+ plc interface and use first found */
+ if (addr == br_mac_zero) {
+ list_for_each_entry(p, &br->port_list, list) {
+ if (strncmp(p->dev->name, "plc", 3) == 0) {
+ addr = p->dev->dev_addr;
+ break;
+ }
+ }
+ }
+
+ /* If PLC interface doesn't exist use interface with minimal MAC address */
+ if (addr == br_mac_zero) {
+ list_for_each_entry(p, &br->port_list, list) {
+ if (addr == br_mac_zero ||
+ memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0) {
+ addr = p->dev->dev_addr;
+ }
+ }
+ }
+#else
+ /* Use interface with minimal MAC address */
list_for_each_entry(p, &br->port_list, list) {
if (addr == br_mac_zero ||
memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
addr = p->dev->dev_addr;
}
-
+#endif
if (compare_ether_addr(br->bridge_id.addr, addr))
br_stp_change_bridge_id(br, addr);
}