aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-04-09 14:49:58 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:50 -0400
commitffe1d49cc300f3dff990093aa952a2fbb371c1b6 (patch)
tree2e23c0f31b0873ff93e3027d176604e9a0a25308 /net/bridge
parentb86c45035c439cfa6ef5b2e4bf080b24bd8765f1 (diff)
bridge: allow changing hardware address to any valid address
For case of bridging pseudo devices, the get created/destroyed (Xen) need to allow setting address to any valid value. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/bridge')
-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)