r6040: generate random ethernet MAC address when not initialized
authorFlorian Fainelli <florian@openwrt.org>
Thu, 8 Jan 2009 15:04:45 +0000 (15:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Jan 2009 08:03:38 +0000 (00:03 -0800)
This patch makes the ethernet driver assign a random ethernet
MAC address when the bootloader does not set it.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/r6040.c

index b59837e..8b5d509 100644 (file)
@@ -1153,8 +1153,10 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
 
        /* Some bootloader/BIOSes do not initialize
         * MAC address, warn about that */
-       if (!(adrp[0] || adrp[1] || adrp[2]))
-               printk(KERN_WARNING DRV_NAME ": MAC address not initialized\n");
+       if (!(adrp[0] || adrp[1] || adrp[2])) {
+               printk(KERN_WARNING DRV_NAME ": MAC address not initialized, generating random\n");
+               random_ether_addr(dev->dev_addr);
+       }
 
        /* Link new device into r6040_root_dev */
        lp->pdev = pdev;