]> Pileus Git - ~andy/linux/commitdiff
lantiq_etop: set addr_assign_type if random_ether_addr() used
authorDanny Kukawka <danny.kukawka@bisect.de>
Fri, 17 Feb 2012 05:43:23 +0000 (05:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Feb 2012 20:52:31 +0000 (15:52 -0500)
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.

v2: added comment, renamed bool variable to random_mac

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/lantiq_etop.c

index 3369b7db777df872c431b4a513ecad9178272c4b..e89808ff73eddcd0ff1a4f6946a1f6eff1b8dfd2 100644 (file)
@@ -634,6 +634,7 @@ ltq_etop_init(struct net_device *dev)
        struct ltq_etop_priv *priv = netdev_priv(dev);
        struct sockaddr mac;
        int err;
+       bool random_mac = false;
 
        ether_setup(dev);
        dev->watchdog_timeo = 10 * HZ;
@@ -646,11 +647,17 @@ ltq_etop_init(struct net_device *dev)
        if (!is_valid_ether_addr(mac.sa_data)) {
                pr_warn("etop: invalid MAC, using random\n");
                random_ether_addr(mac.sa_data);
+               random_mac = true;
        }
 
        err = ltq_etop_set_mac_address(dev, &mac);
        if (err)
                goto err_netdev;
+
+       /* Set addr_assign_type here, ltq_etop_set_mac_address would reset it. */
+       if (random_mac)
+               dev->addr_assign_type |= NET_ADDR_RANDOM;
+
        ltq_etop_set_multicast_list(dev);
        err = ltq_etop_mdio_init(dev);
        if (err)