Re: [PATCH] net: usb: usbnet: restore usb%d name exception for local mac addresses
From: Dominique Martinet
Date: Thu Dec 05 2024 - 04:18:00 EST
Andrew Lunn wrote on Tue, Dec 03, 2024 at 09:47:57PM +0100:
> On Tue, Dec 03, 2024 at 10:04:55PM +0900, Dominique Martinet wrote:
> > From: Dominique Martinet <dominique.martinet@xxxxxxxxxxxxxxxxx>
> >
> > The previous commit assumed that local addresses always came from the
> > kernel, but some devices hand out local mac addresses so we ended up
> > with point-to-point devices with a mac set by the driver, renaming to
> > eth%d when they used to be named usb%d.
> >
> > Userspace should not rely on device name, but for the sake of stability
> > restore the local mac address check portion of the naming exception:
> > point to point devices which either have no mac set by the driver or
> > have a local mac handed out by the driver will keep the usb%d name.
>
> Are you saying the OTP or NVMEM has a locally administered MAC address
> stored in it?
I'm afraid so... (At least the Gemalto^W Cinterion^W Thales^W Telit
ELS31-J we use on a couple of boards seem to do that, it's soldered on
our boards so I can't swap it out easily to confirm but the mac address
is stable accross reboots)
The good news is that after having been sold at least 4 times it's been
made EOL now, so in another 12-ish years I'll probably be able to ignore
this particular problem :)
> Is there a mechanism to change it?
Looking at some confidential documentation I found on our file server
there seems to be an usb function that contains the mac address and
various ethernet statistics, but it's not clear to me if it's actually
writable or even how to actually use it in practice and it was certainly
not designed with being modified in mind.
(I suspect there should be some vendor AT command that would allow
overriding the setting somewhere but I can't find that either)
OTOH, just changing the mac locally (ip link set usb0 addr
02:12:34:56:78:90) works and dhcp gets me a new IP, so it's not like
overriding it is a problem either.
(interestingly putting the old mac back gets me the old IP back, so
there's a real dhcp server with leases behind this and I suspect I
could just bridge this out and it'd work as expected...)
> The point about locally administered MAC addresses is that they are
> locally administered.
Honest question here our of curiosity, my reading of a few random pages
on the internet is that it would be acceptable for the modem to randomly
generate it?
(under the assumption that e.g. a reset would clear it and get me a new
mac)
Or does it have to be assigned as late as possible, e.g. we'd want linux
to be generating it in this case?
Thanks,
--
Dominique