aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-06-17 19:10:06 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-17 19:10:06 -0400
commit92c0574f11598c8036f81e27d2e8bdd6eed7d76d (patch)
tree179c0a8ef7291cc65a692043310b543d35c16eac /net/bridge
parent43aa1920117801fe9ae3d1fad886b62511e09bee (diff)
bridge: make bridge address settings sticky
Normally, the bridge just chooses the smallest mac address as the bridge id and mac address of bridge device. But if the administrator has explictly set the interface address then don't change it. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_device.c1
-rw-r--r--net/bridge/br_private.h2
-rw-r--r--net/bridge/br_stp_if.c4
3 files changed, 7 insertions, 0 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index a6ffc6c2a69f..d9449df7cad5 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -87,6 +87,7 @@ static int br_set_mac_address(struct net_device *dev, void *p)
87 spin_lock_bh(&br->lock); 87 spin_lock_bh(&br->lock);
88 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 88 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
89 br_stp_change_bridge_id(br, addr->sa_data); 89 br_stp_change_bridge_id(br, addr->sa_data);
90 br->flags |= BR_SET_MAC_ADDR;
90 spin_unlock_bh(&br->lock); 91 spin_unlock_bh(&br->lock);
91 92
92 return 0; 93 return 0;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 83ff5861c2d2..8593c9f6a302 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -92,6 +92,8 @@ struct net_bridge
92 struct hlist_head hash[BR_HASH_SIZE]; 92 struct hlist_head hash[BR_HASH_SIZE];
93 struct list_head age_list; 93 struct list_head age_list;
94 unsigned long feature_mask; 94 unsigned long feature_mask;
95 unsigned long flags;
96#define BR_SET_MAC_ADDR 0x00000001
95 97
96 /* STP */ 98 /* STP */
97 bridge_id designated_root; 99 bridge_id designated_root;
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 1a4e5c37a0cf..9a52ac5b4525 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -214,6 +214,10 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
214 const unsigned char *addr = br_mac_zero; 214 const unsigned char *addr = br_mac_zero;
215 struct net_bridge_port *p; 215 struct net_bridge_port *p;
216 216
217 /* user has chosen a value so keep it */
218 if (br->flags & BR_SET_MAC_ADDR)
219 return;
220
217 list_for_each_entry(p, &br->port_list, list) { 221 list_for_each_entry(p, &br->port_list, list) {
218 if (addr == br_mac_zero || 222 if (addr == br_mac_zero ||
219 memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0) 223 memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)