aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2021-04-12 14:27:25 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-11-28 22:43:08 +0100
commitd1464afe1bb878a6202861b9bd2845be74f39b5f (patch)
treeb4155f9443bce1ada57d2a24215861cef9321fd0
parent9e7149f729e9b7b18a2ad0e7ba9d939f678e3eac (diff)
downloadupstream-d1464afe1bb878a6202861b9bd2845be74f39b5f.tar.gz
upstream-d1464afe1bb878a6202861b9bd2845be74f39b5f.tar.bz2
upstream-d1464afe1bb878a6202861b9bd2845be74f39b5f.zip
realtek: use full range of assigned MAC addresses
Some devices are assigned globally unique MAC addresses for all ports. These are stored by U-Boot in the second U-Boot enviroment ("sysinfo") as a range of start and end address. Use the full range if provided. Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r--target/linux/realtek/base-files/etc/board.d/02_network9
1 files changed, 6 insertions, 3 deletions
diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 4eeb5768e3..93d6d4bd1e 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -25,11 +25,14 @@ ucidef_set_bridge_device switch
ucidef_set_interface_lan "$lan_list"
lan_mac=""
+lan_mac_end=""
label_mac=""
case $board in
*)
- lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
- label_mac=$lan_mac
+ lan_mac=$(mtd_get_mac_ascii u-boot-env2 mac_start)
+ lan_mac_end=$(mtd_get_mac_ascii u-boot-env2 mac_end)
+ label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+ [ -z "$lan_mac" ] && lan_mac=$label_mac
;;
esac
@@ -38,7 +41,7 @@ ucidef_set_bridge_mac "$lan_mac"
ucidef_set_network_device_mac eth0 $lan_mac
for lan in $lan_list; do
ucidef_set_network_device_mac $lan $lan_mac
- lan_mac=$(macaddr_setbit_la $lan_mac)
+ [ -z "$lan_mac_end" ] || [ "$lan_mac" == "$lan_mac_end" ] && lan_mac=$(macaddr_setbit_la $lan_mac)
lan_mac=$(macaddr_add $lan_mac 1)
done
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac