The following commit has been merged in the master branch: commit 910ccacb9dd2bfac8ce1ac411af514fe72fa84c0 Author: Danny Kukawka danny.kukawka@bisect.de Date: Wed Feb 8 22:10:47 2012 +0100
batman-adv: use dev_hw_addr_random() instead of random_ether_addr()
Use dev_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.
Signed-off-by: Danny Kukawka danny.kukawka@bisect.de [lindner_marek@yahoo.de: minor flag handling modification] Signed-off-by: Marek Lindner lindner_marek@yahoo.de
diff --git a/soft-interface.c b/soft-interface.c index 8de8779..7047a47 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -108,6 +108,9 @@ static int interface_set_mac_addr(struct net_device *dev, void *p) }
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + if (dev->addr_assign_type & NET_ADDR_RANDOM) + dev->addr_assign_type &= ~NET_ADDR_RANDOM; + return 0; }
@@ -323,7 +326,6 @@ static const struct net_device_ops bat_netdev_ops = { static void interface_setup(struct net_device *dev) { struct bat_priv *priv = netdev_priv(dev); - char dev_addr[ETH_ALEN];
ether_setup(dev);
@@ -340,8 +342,7 @@ static void interface_setup(struct net_device *dev) dev->hard_header_len = BAT_HEADER_LEN;
/* generate random address */ - random_ether_addr(dev_addr); - memcpy(dev->dev_addr, dev_addr, ETH_ALEN); + dev_hw_addr_random(dev, dev->dev_addr);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);