realtek: Skip auto-MAC assignment for devices with MACs in DT

If the devicetree contains the appropriate nodes to configure the MAC
addresses for each physical DSA port, then these MAC addresses must be used
in OpenWrt and not some automatically generated ones. Otherwise the device
often ends up with addresses which are locally administered and not
matching any expected port-to-MAC scheme.

Devices which only get the MAC address for eth0 must still auto-generate
these MAC addresses until the devicetree was updated to also include the
correct ones.

Signed-off-by: Sven Eckelmann <se@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20241
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Sven Eckelmann 2025-09-29 18:30:12 +02:00 committed by Hauke Mehrtens
parent 18e1929401
commit 3f7776a260

View File

@ -70,7 +70,10 @@ realtek_setup_macs()
plasmacloud,esx28|\
plasmacloud,psx8|\
plasmacloud,psx10|\
plasmacloud,psx28|\
plasmacloud,psx28)
lan_mac_start=skip
lan_mac="$(get_mac_label)"
;;
tplink,sg2008p-v1|\
tplink,sg2210p-v3|\
tplink,sg2452p-v4|\
@ -102,7 +105,7 @@ realtek_setup_macs()
[ -n "$lan_mac" ] && ucidef_set_network_device_mac eth0 $lan_mac
[ -z "$lan_mac_start" -a -n "$lan_mac" ] && lan_mac_start=$lan_mac
realtek_setup_macs_lan "$lan_list" "$lan_mac_start" "$lan_mac_end"
[ "$lan_mac_start" != "skip" ] && realtek_setup_macs_lan "$lan_list" "$lan_mac_start" "$lan_mac_end"
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
}