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>
This commit is contained in:

committed by
David S. Miller

parent
f2cedb63df
commit
7ce5d22219
@@ -1080,6 +1080,7 @@ static int ks8842_set_mac(struct net_device *netdev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
netdev->addr_assign_type &= ~NET_ADDR_RANDOM;
|
||||
memcpy(netdev->dev_addr, mac, netdev->addr_len);
|
||||
|
||||
ks8842_write_mac_addr(adapter, mac);
|
||||
@@ -1211,7 +1212,7 @@ static int __devinit ks8842_probe(struct platform_device *pdev)
|
||||
ks8842_read_mac_addr(adapter, netdev->dev_addr);
|
||||
|
||||
if (!is_valid_ether_addr(netdev->dev_addr))
|
||||
random_ether_addr(netdev->dev_addr);
|
||||
eth_hw_addr_random(netdev);
|
||||
}
|
||||
|
||||
id = ks8842_read16(adapter, 32, REG_SW_ID_AND_ENABLE);
|
||||
|
Reference in New Issue
Block a user