[openwrt/openwrt] ipq40xx: use correct wired MAC-addresses for RUTX50

LEDE Commits lede-commits at lists.infradead.org
Mon Jan 13 06:46:02 PST 2025


blocktrron pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/08c93512fe39ac25f78fb2ab0f32cb2a830c5b70

commit 08c93512fe39ac25f78fb2ab0f32cb2a830c5b70
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Mon Jan 13 15:18:31 2025 +0100

    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 <mail at david-bauer.net>
---
 .../base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh        | 11 +++++++++++
 1 file changed, 11 insertions(+)

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)




More information about the lede-commits mailing list