]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
bridge: make bridge address settings sticky
authorStephen Hemminger <shemminger@vyatta.com>
Tue, 17 Jun 2008 23:10:06 +0000 (16:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Jun 2008 23:10:06 +0000 (16:10 -0700)
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>
net/bridge/br_device.c
net/bridge/br_private.h
net/bridge/br_stp_if.c

index a6ffc6c2a69fba24bc390ea8171637fae0bbbf97..d9449df7cad518d52d499b201d4e2cfd6ab4718f 100644 (file)
@@ -87,6 +87,7 @@ static int br_set_mac_address(struct net_device *dev, void *p)
        spin_lock_bh(&br->lock);
        memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
        br_stp_change_bridge_id(br, addr->sa_data);
+       br->flags |= BR_SET_MAC_ADDR;
        spin_unlock_bh(&br->lock);
 
        return 0;
index 83ff5861c2d29025600846e909d3d1e168433d06..8593c9f6a30264e1027e6b3d49db3227fbb0616d 100644 (file)
@@ -92,6 +92,8 @@ struct net_bridge
        struct hlist_head               hash[BR_HASH_SIZE];
        struct list_head                age_list;
        unsigned long                   feature_mask;
+       unsigned long                   flags;
+#define BR_SET_MAC_ADDR                0x00000001
 
        /* STP */
        bridge_id                       designated_root;
index 1a4e5c37a0cf2c5efcb4472143d03c3ebeaa73eb..9a52ac5b452557ad945aa69e79ed3e86aecd21ef 100644 (file)
@@ -214,6 +214,10 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
        const unsigned char *addr = br_mac_zero;
        struct net_bridge_port *p;
 
+       /* user has chosen a value so keep it */
+       if (br->flags & BR_SET_MAC_ADDR)
+               return;
+
        list_for_each_entry(p, &br->port_list, list) {
                if (addr == br_mac_zero ||
                    memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)