RaspberryPi3+: can't set mac address from device tree
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux-raspi2 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Impact:
The RaspberryPi3+ board came with an usb's to ethernet lan78xx nic adapter - thhis chip has no external eeprom, nor internal preprogrammed mac address and as such, after every reboot, it generates a random new ethernet mac address.
Supposedly, the lan78xx driver is able to read its mac address from the device tree passed to the kernel (see d093067 "lan78xx: Read MAC address from DT if present"), making it possible to have reproducible/fixed mac addresses, but unfortunately this feature isn't working in our Xenial/raspi2 kernel (while it's working fine in Bionc/raspi2).
After some debugging i found that the usb_net struct backing the lan78xx driver, had no clue about the dt node it was associated, making this piece of code constantly evaluates to NULL:
static void lan78xx_
...
mac_addr = of_get_
...
There "of_node" was always NULL.
After more debugging, i found that the feature to bind usb_net devices and device tree nodes was introduced in the Linux 4.6 cycle, and as such Xenial didn't have it.
Fix:
Apply the patch and recompile
How to test:
Upon boot of the RaspberryPi3+ board (and after the dtb has been loaded into memory), stop at the uboot prompt and check the usbeether device node:
U-Boot> fdt print /soc/usb/
usbether@1 {
compatible = "usb424,7800";
reg = <0x00000001>;
phandle = <0x00000024>;
};
the "local-mac-address" has been filled by the Broadcom bootloader, and contains the lan78xx's mac address.
Then proceed with the boot routine, readh the user prompt, and check eth0's mac address:
$ ifconfig eth0 | grep HWaddr
eth0 Link encap:Ethernet HWaddr b8:27:eb:ce:07:ba
If it's the same as above, then the fix worked.
Regression:
The patch itself has been upstream since v4.6-rc1, and it changes a very small portion of code, so i'll say it's regression potential is very low / none.
CVE References
summary: |
- rpi3b+: can't set mac addrss from device tree + RaspberryPi3+: can't set mac address from device tree |
Changed in linux-raspi2 (Ubuntu Xenial): | |
status: | New → In Progress |
Changed in linux-raspi2 (Ubuntu Xenial): | |
status: | In Progress → Fix Committed |
@p-pisati what's the ETA on this? We're desperate for this feature. See https:/ /bugs.launchpad .net/ubuntu/ +source/ linux-raspi2/ +bug/1798578