diff options
author | Danny Kukawka <danny.kukawka@bisect.de> | 2012-02-09 04:48:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-13 00:46:41 -0500 |
commit | c8585bd89e2e3c87eab6ca711e09b3af20fd469b (patch) | |
tree | 22aab521752dbd37a590045935b3d1229398f992 /net/ethernet | |
parent | 4c507d2897bd9be810b3403ade73b04cf6fdfd4a (diff) |
eth: reset addr_assign_type if eth_mac_addr() called
If eth_mac_addr() get called, usually if SIOCSIFHWADDR was
used to change the MAC of a ethernet device, reset the
addr_assign_type to NET_ADDR_PERM if the state was
NET_ADDR_RANDOM before. Reset the state since the MAC is
no longer random at least not from the kernel side.
v2: changed to bitops, removed if()
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet')
-rw-r--r-- | net/ethernet/eth.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index a2468363978e..a93af86b8474 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -288,6 +288,8 @@ int eth_mac_addr(struct net_device *dev, void *p) | |||
288 | if (!is_valid_ether_addr(addr->sa_data)) | 288 | if (!is_valid_ether_addr(addr->sa_data)) |
289 | return -EADDRNOTAVAIL; | 289 | return -EADDRNOTAVAIL; |
290 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | 290 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
291 | /* if device marked as NET_ADDR_RANDOM, reset it */ | ||
292 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | ||
291 | return 0; | 293 | return 0; |
292 | } | 294 | } |
293 | EXPORT_SYMBOL(eth_mac_addr); | 295 | EXPORT_SYMBOL(eth_mac_addr); |