mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 10:51:51 +00:00
getBuiltinEthernetPorts crashed with "Unknown error"
on hardware where NICs have PCI subsystem symlinks at
different sysfs depths (e.g. onboard NIC vs PCIe card NIC).
The getBuiltinEthernetPorts x86_64 workaround block
needs realpath() to resolve PCI subsystem symlinks.
readlink() returns different strings ("../../../bus/pci" vs
"../../../../bus/pci") even though both resolve to /sys/bus/pci,
causing eth1 and eth2 to be incorrectly excluded from the result.
E.g.:
eth0: /sys/class/net/eth0/device/subsystem -> ../../../bus/pci
eth1: /sys/class/net/eth1/device/subsystem -> ../../../../bus/pci
eth2: /sys/class/net/eth2/device/subsystem -> ../../../../bus/pci
1. Add realpath to the 'fs' module import statement
2. Use realpath() to normalize paths
Closes #8425
Reported-by: @MI2-2
Signed-off-by: Paul Donald <newtwen+github@gmail.com>