]> Pileus Git - ~andy/linux/commitdiff
batman-adv: use eth_hw_addr_random() instead of random_ether_addr()
authorDanny Kukawka <danny.kukawka@bisect.de>
Fri, 17 Feb 2012 05:43:27 +0000 (05:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Feb 2012 20:58:06 +0000 (15:58 -0500)
Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.

Remove dev_addr in interface_setup(), it's not needed anymore.

Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.

v2: use bitops, adapt to eth_hw_addr_random()

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/batman-adv/soft-interface.c

index b5aecd5e45ccea4f8f21d509e5b59bfacb13a5d5..2d8bd2ad6ba384dd80be5a997821e05fe12e4a23 100644 (file)
@@ -541,6 +541,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)
        }
 
        memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+       dev->addr_assign_type &= ~NET_ADDR_RANDOM;
        return 0;
 }
 
@@ -783,7 +784,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);
 
@@ -800,8 +800,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);
+       eth_hw_addr_random(dev);
 
        SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);