FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 02-21-2012, 09:47 AM
Paolo Pisati
 
Default smsc95xx: panda: don't blindly overwrite MAC address

During eth0 registration (NETDEV_REGISTER) don't blindly overwrite
eth0 MAC address using die id supplied one, but check if the
actual MAC was randomly generated and, only in that case, overwrite it.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
arch/arm/mach-omap2/board-omap4panda.c | 4 ++++
drivers/net/usb/smsc95xx.c | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 035d56f..f1e8e6d 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -738,6 +738,10 @@ static int omap_panda_netdev_event(struct notifier_block *this,
if (event != NETDEV_REGISTER)
return NOTIFY_DONE;

+ if (strncmp(dev->name, "eth0", 4) == 0 &&
+ !(dev->addr_assign_type & NET_ADDR_RANDOM))
+ return NOTIFY_DONE;
+
n = panda_device_path_need_mac(dev->dev.parent);
if (n >= 0) {
sa.sa_family = dev->type;
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 89b51bd..ea95dd1 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -669,7 +669,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
}

/* no eeprom, or eeprom values are invalid. generate random MAC */
- random_ether_addr(dev->net->dev_addr);
+ dev_hw_addr_random(dev->net, dev->net->dev_addr);
netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr
");
}

--
1.7.9


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 11:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org