Skip to content

Commit

Permalink
eth: reset addr_assign_type if eth_mac_addr() called
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dalgaaf authored and davem330 committed Feb 13, 2012
1 parent 4c507d2 commit c8585bd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ethernet/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ int eth_mac_addr(struct net_device *dev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
/* if device marked as NET_ADDR_RANDOM, reset it */
dev->addr_assign_type &= ~NET_ADDR_RANDOM;
return 0;
}
EXPORT_SYMBOL(eth_mac_addr);
Expand Down

0 comments on commit c8585bd

Please sign in to comment.