Patchwork [2/4] r6040: generate random ethernet MAC address when not initialized

login
register
mail settings
Submitter Florian Fainelli
Date Jan. 9, 2009, 1:04 a.m.
Message ID <200901090204.45766.florian@openwrt.org>
Download mbox | patch
Permalink /patch/17453/
State Accepted
Delegated to: David Miller
Headers show

Comments

Florian Fainelli - Jan. 9, 2009, 1:04 a.m.
From: Florian Fainelli <florian@openwrt.org>
Subject: [PATCH 2/4] r6040: generate random ethernet MAC address when not initialized

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>
---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 10, 2009, 7:07 a.m.
From: Florian Fainelli <florian@openwrt.org>
Date: Fri, 9 Jan 2009 02:04:45 +0100

> From: Florian Fainelli <florian@openwrt.org>
> Subject: [PATCH 2/4] r6040: generate random ethernet MAC address when not initialized
> 
> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 6b8bc6d..21d830b 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -1138,8 +1138,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;