Re: [PATCH] smsc75xx: only set mac address once on bind
From: Steve Glendinning <hidden>
Date: 2012-12-11 14:35:44
Hi Dan, On 10 December 2012 23:00, Dan Williams [off-list ref] wrote:
On Mon, 2012-12-10 at 11:01 +0000, Steve Glendinning wrote:quoted
This patch changes when we decide what the device's MAC address is from per ifconfig up to once when the device is connected. Without this patch, a manually forced device MAC is overwritten on ifconfig down/up. Also devices that have no EEPROM are assigned a new random address on ifconfig down/up instead of persisting the same one.Does this mean that on devices without EEPROM, ifconfig XXX down/ifconfig XXX up will generate a *new* random address? That seems a bit odd; why wouldn't the first random address generated for the device persist until either (a) changed by ifconfig or (b) device was disconnected?
Sorry if my commit message wasn't clear enough. That is indeed a bit odd, and it describes the (buggy) behaviour BEFORE this patch was applied. With this patch applied, devices without EEPROM (and without a manually specified MAC address) will get a randomly generated address assigned once at bind time, so this MAC will persist for the lifetime the USB device is connected. We also now won't trash a manually specified MAC, for cases where userland sets the MAC before bringing up the interface. -- Steve Glendinning