[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJWATVhMVDgq3fcV9zpZRt8nd_bWp3=qRHo8L3tJP==Kg@mail.gmail.com>
Date: Tue, 15 Oct 2024 01:00:53 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Oliver Neukum <oneukum@...e.com>
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...nel.org,
John Sperbeck <jsperbeck@...gle.com>, Brian Vazquez <brianvv@...gle.com>
Subject: Re: [PATCHv2 net] usbnet: modern method to get random MAC
On Tue, Oct 15, 2024 at 12:24 AM Oliver Neukum <oneukum@...e.com> wrote:
>
> On 14.10.24 21:59, Eric Dumazet wrote:
>
> > As diagnosed by John Sperbeck :
> >
> > This patch implies all ->bind() method took care of populating net->dev_addr ?
> >
> > Otherwise the following existing heuristic is no longer working
> >
> > // heuristic: "usb%d" for links we know are two-host,
> > // else "eth%d" when there's reasonable doubt. userspace
> > // 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))
> > strscpy(net->name, "eth%d", sizeof(net->name));
> >
>
> Hi,
>
> you need to have a MAC to be an ethernet device, don't you?
Before or after your patch, there was/is a MAC address, eventually random.
The problem is about the test, which is now done while dev->dev_addr
is full of zeroes, which is not a valid address,
as shown by :
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e4775fb5a2f6..1a316773319f 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1750,7 +1750,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))
+ (is_valid_ether_addr(net->dev_addr) &&
+ (net->dev_addr [0] & 0x02) == 0)))
strscpy(net->name, "eth%d", sizeof(net->name));
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
To be clear : We are hitting a regression after your patch was
backported to stable versions.
Powered by blists - more mailing lists