[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241017071849.389636-1-oneukum@suse.com>
Date: Thu, 17 Oct 2024 09:18:37 +0200
From: Oliver Neukum <oneukum@...e.com>
To: edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org
Cc: Oliver Neukum <oneukum@...e.com>,
Greg Thelen <gthelen@...gle.com>,
John Sperbeck <jsperbeck@...gle.com>
Subject: [PATCH net] net: usb: usbnet: fix name regression
The fix for MAC addresses broke detection of the naming convention
because it gave network devices no random MAC before bind()
was called. This means that the check for the local assignment bit
was always negative as the address was zeroed from allocation,
instead of from overwriting the MAC with a unique hardware address.
The correct check for whether bind() has altered the MAC is
done with is_zero_ether_addr
Signed-off-by: Oliver Neukum <oneukum@...e.com>
Reported-by: Greg Thelen <gthelen@...gle.com>
Diagnosed-by: John Sperbeck <jsperbeck@...gle.com>
Fixes: bab8eb0dd4cb9 ("usbnet: modern method to get random MAC")
---
drivers/net/usb/usbnet.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ee1b5fd7b491..44179f4e807f 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1767,7 +1767,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
// can rename the link if it knows better.
if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
- (net->dev_addr [0] & 0x02) == 0))
+ /* somebody touched it*/
+ !is_zero_ether_addr(net->dev_addr)))
strscpy(net->name, "eth%d", sizeof(net->name));
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
--
2.47.0
Powered by blists - more mailing lists