Re: Getting a stable MAC address for a RPI CM3+ with ue0 interface

Ronald Klop <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On 9/25/23 19:10, Patrick M. Hausen wrote:
> Hi all
> 
>> Am 24.09.2023 um 23:05 schrieb Patrick M. Hausen <[email protected]>:
>>
>> Hi all
>>
>>> Am 23.09.2023 um 21:28 schrieb Ronald Klop <[email protected]>:
>>>
>>> Would this work?
>>>
>>> diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c
>>> index 0a0268bfa1a2..4a7983a20717 100644
>>> --- a/sys/dev/usb/net/if_smsc.c
>>> +++ b/sys/dev/usb/net/if_smsc.c
>>> [...]
>>
>> After building and installing the kernel with this patch and reboot I
>> lost access to the node I used. I will try to set up console access
>> somehow ...
> 
> The development board I use for flashing etc. has got a serial port
> connector and even a USB to serial converter so you can just plug in
> USB to your laptop - I did not get any console output, though.
> 
> https://www.waveshare.com/wiki/Compute_Module_PoE_Board#Serial_port
> 
> I did get console output via HDMI, but my Apple keyboard seems not
> to work when plugged in to USB so I could not really examine what
> is wrong or boot into kernel.old - only diagonistic I can provide:
> 
> The new kernel prints the "No MAC address found" message, then panics.
> 
> I'm reflashing the module now ...
> 
>  From reading your source code, what are you really trying to achieve?
> More diagnostic messages are a good thing, but from where are you
> trying to read that MAC address?


The method ether_gen_addr() generates a MAC address bases on hostuuid and interface name. Maybe not ideal, bu a lot better then a random MAC.

sys/net/if_ethersubr.c:
/*
  * Allocate an address from the FreeBSD Foundation OUI.  This uses a
  * cryptographic hash function on the containing jail's name, UUID and the
  * interface name to attempt to provide a unique but stable address.
  * Pseudo-interfaces which require a MAC address should use this function to
  * allocate non-locally-administered addresses.
  */
void
ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr)


It would be nice to see more information from the panic. Can you make a picture or movie of the screen while this happens?
Or does the system make a kernel crashdump? See "dumpdev" in /etc/defaults/rc.conf. A crashdump is written to the swap partition and on reboot a summary is written in /var/crash from what is in the swap partition. This is all assuming the system has a large enough swap partition.

Regards,
Ronald.


> As far as I understand for the Pi you are supposed to use the RPi
> foundation OUI B8:27:EB plus the lower three octets of the Pi's
> serial number - regardless of the Ethernet adapter plugged in.
> 
> All Pis running Linux do this.
> 
> Kind regards,
> Patrick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.