
On Tue, Nov 16, 2021 at 03:56:45PM +0100, Wolfgang Denk wrote:
Dear Tom,
In message 20211116141855.GD24579@bill-the-cat you wrote:
So, to quote lib/Kconfig: config NET_RANDOM_ETHADDR bool "Random ethaddr if unset" help Selecting this will allow the Ethernet interface to function even when the ethaddr variable for that interface is unset. A new MAC address will be generated on every boot and it will not be added to the environment.
This description is at least incomplete, because it makes no difference between the persistent copy of the environment and it's in-memory copy. For network to function, I think the MAC address must be stored in the in-memory copy of the environment.
Well, networking has been working with NET_RANDOM_ETHADDR not updating the environment, with caveats that user display information that reads from the environment rather than ->enetaddr. In so far as the networking stack cares, ->enetaddr is what matters. We look at the environment for a MAC, and if it doesn't match the HW we use environment MAC, but warn.
Now, I think RFC7042 is the current correct and relevant RFC here and it doesn't mention persistence. So I don't see a clear external authority on if locally administered MAC addresses like this should be persistent or not in this manner.
We need either a re-spin or follow-up as we're changing the documented behavior. And as I mentioned in the other thread related on-going thread, perhaps "ethmacskip" should play a role in preserving existing behavior?
We have way too many ways to do the same thing - nearly, just a little different :-(
Well, in this case I'm not sure that's the right problem to point at. We can just set ethmacskip as a bit of corner-case functionality and move on.
Because honestly, the more I read this, the more I think https://patchwork.ozlabs.org/project/uboot/patch/20211115121152.3470910-1-mi... is essentially the right direction. There's no reason for 'net list' to be using the environment here when ->enetaddr is what's being used by the stack. The use case of "I want to make my locally administered MAC persist because my USB ethernet adapter lacks a MAC address" is solved via the environment already.