lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1296556457-4969-1-git-send-email-sakib@meta.ua>
Date:	Tue,  1 Feb 2011 12:34:17 +0200
From:	Sergiy Kibrik <sakib@...a.ua>
To:	Steve Glendinning <steve.glendinning@...c.com>
Cc:	netdev@...r.kernel.org, linux-usb@...r.kernel.org,
	Sergiy Kibrik <sakib@...a.ua>
Subject: [PATCH] usb:smsc: preserve MAC address when resetting device

Initialize MAC address only once, when device opened first time
to avoid generation random addresses when failed to read one from ROM.

Some hardware hasn't hw address in ROM, e.g. Pandaboard  (http://pandaboard.org),
so every time device is up, its address is regenerated again.
It makeis impossible to set custom hw address and also makes DHCP servers and switches crazy.

Signed-off-by: Sergiy Kibrik <sakib@...a.ua>
---
 drivers/net/usb/smsc75xx.c |    6 +++++-
 drivers/net/usb/smsc95xx.c |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 753ee6e..a45dfa2 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -77,6 +77,7 @@ struct usb_context {
 };
 
 static int turbo_mode = true;
+static int first_reset = true;
 module_param(turbo_mode, bool, 0644);
 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
 
@@ -836,7 +837,10 @@ static int smsc75xx_reset(struct usbnet *dev)
 
 	netif_dbg(dev, ifup, dev->net, "PHY reset complete");
 
-	smsc75xx_init_mac_address(dev);
+	if (first_reset){
+		smsc75xx_init_mac_address(dev);
+		first_reset = false;
+	}
 
 	ret = smsc75xx_set_mac_address(dev);
 	check_warn_return(ret, "Failed to set mac address");
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bc86f4b..83008c1 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -59,6 +59,7 @@ struct usb_context {
 	struct usbnet *dev;
 };
 
+static int first_reset = true;
 static int turbo_mode = true;
 module_param(turbo_mode, bool, 0644);
 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
@@ -1045,7 +1046,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
 	pdata->use_tx_csum = DEFAULT_TX_CSUM_ENABLE;
 	pdata->use_rx_csum = DEFAULT_RX_CSUM_ENABLE;
 
-	smsc95xx_init_mac_address(dev);
+	if (first_reset){
+		smsc95xx_init_mac_address(dev);
+		first_reset = false;
+	}
 
 	/* Init all registers */
 	ret = smsc95xx_reset(dev);
-- 
1.7.1

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ