summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@bisect.de>2012-02-15 06:45:40 +0000
committerDavid S. Miller <davem@davemloft.net>2012-02-15 15:34:17 -0500
commit7ce5d222190cb3ce3ae88bafde7c4fa52a5103e0 (patch)
tree2b284365b7a2e11d4ba286a589bd35bc39918805 /net
parentf2cedb63df14342ad40a8b5b324fc5d94a60b665 (diff)
net: use eth_hw_addr_random() and reset addr_assign_type
Use eth_hw_addr_random() instead of calling random_ether_addr() to set addr_assign_type correctly to NET_ADDR_RANDOM. Reset the state to NET_ADDR_PERM as soon as the MAC get changed via .ndo_set_mac_address. v2: adapt to renamed eth_hw_addr_random() Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_device.c3
-rw-r--r--net/openvswitch/vport-internal_dev.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 71773b014e0..a157bf827d8 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -171,6 +171,7 @@ static int br_set_mac_address(struct net_device *dev, void *p)
spin_lock_bh(&br->lock);
if (compare_ether_addr(dev->dev_addr, addr->sa_data)) {
+ dev->addr_assign_type &= ~NET_ADDR_RANDOM;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
br_fdb_change_mac_address(br, addr->sa_data);
br_stp_change_bridge_id(br, addr->sa_data);
@@ -334,7 +335,7 @@ void br_dev_setup(struct net_device *dev)
{
struct net_bridge *br = netdev_priv(dev);
- random_ether_addr(dev->dev_addr);
+ eth_hw_addr_random(dev);
ether_setup(dev);
dev->netdev_ops = &br_netdev_ops;
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 322b8d20669..b6b1d7daa3c 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -66,6 +66,7 @@ static int internal_dev_mac_addr(struct net_device *dev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
+ dev->addr_assign_type &= ~NET_ADDR_RANDOM;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
return 0;
}
@@ -145,7 +146,7 @@ static void do_setup(struct net_device *netdev)
netdev->vlan_features = netdev->features;
netdev->features |= NETIF_F_HW_VLAN_TX;
netdev->hw_features = netdev->features & ~NETIF_F_LLTX;
- random_ether_addr(netdev->dev_addr);
+ eth_hw_addr_random(netdev);
}
static struct vport *internal_dev_create(const struct vport_parms *parms)