From: David Bauer Date: Mon, 13 Jan 2025 14:18:31 +0000 (+0100) Subject: ipq40xx: use correct wired MAC-addresses for RUTX50 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=08c93512fe39ac25f78fb2ab0f32cb2a830c5b70;p=openwrt%2Fopenwrt.git ipq40xx: use correct wired MAC-addresses for RUTX50 The Teltonika RUTX50 mac-addresses on its wired interfaces are currently random on every boot. Setting the mac-addresses from device-tree using nvmem does not work, as the vendor bootloader mangles the mtd partitions, removing the nvmem-cells property. To remedy the random mac-addresse, set the correct ones in preinit. Signed-off-by: David Bauer --- diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 1ede544aac..092f9da440 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -43,6 +43,17 @@ preinit_set_mac_address() { ip link set dev sw-eth1 address "$base_mac" ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) ;; + teltonika,rutx50) + # Vendor Bootloader removes nvmem-cells from partition, + # so this needs to be done here. + base_mac="$(mtd_get_mac_binary 0:CONFIG 0x0)" + ip link set dev eth0 address "$base_mac" + ip link set dev lan1 address "$base_mac" + ip link set dev lan2 address "$base_mac" + ip link set dev lan3 address "$base_mac" + ip link set dev lan4 address "$base_mac" + ip link set dev wan address "$(macaddr_add "$base_mac" 1)" + ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth0 address $(macaddr_add "$base_mac" 2)