aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bridge/br_device.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index b22ada529cc3..39b87dad35b7 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -83,27 +83,22 @@ static int br_change_mtu(struct net_device *dev, int new_mtu)
83 return 0; 83 return 0;
84} 84}
85 85
86/* Allow setting mac address of pseudo-bridge to be same as 86/* Allow setting mac address to any valid ethernet address. */
87 * any of the bound interfaces
88 */
89static int br_set_mac_address(struct net_device *dev, void *p) 87static int br_set_mac_address(struct net_device *dev, void *p)
90{ 88{
91 struct net_bridge *br = netdev_priv(dev); 89 struct net_bridge *br = netdev_priv(dev);
92 struct sockaddr *addr = p; 90 struct sockaddr *addr = p;
93 struct net_bridge_port *port; 91 struct net_bridge_port *port;
94 int err = -EADDRNOTAVAIL; 92
93 if (!is_valid_ether_addr(addr->sa_data))
94 return -EINVAL;
95 95
96 spin_lock_bh(&br->lock); 96 spin_lock_bh(&br->lock);
97 list_for_each_entry(port, &br->port_list, list) { 97 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
98 if (!compare_ether_addr(port->dev->dev_addr, addr->sa_data)) { 98 br_stp_change_bridge_id(br, addr->sa_data);
99 br_stp_change_bridge_id(br, addr->sa_data);
100 err = 0;
101 break;
102 }
103 }
104 spin_unlock_bh(&br->lock); 99 spin_unlock_bh(&br->lock);
105 100
106 return err; 101 return 0;
107} 102}
108 103
109static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) 104static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)