Browse Source

ar71xx: fix MAC addresses on TP-Link TL-WR1043ND v4

Matthias Schiffer 6 years ago
parent
commit
26c55f2819

+ 41 - 0
patches/openwrt/0122-ar71xx-fix-MAC-addresses-on-TP-Link-TL-WR1043ND-v4.patch

@@ -0,0 +1,41 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 11 Sep 2017 19:41:41 +0200
+Subject: ar71xx: fix MAC addresses on TP-Link TL-WR1043ND v4
+
+The addresses were read from the 'config' partition, which would not always
+contain the addresses at the same offsets, depending on the stock firmware
+version used before flashing LEDE. Change this to get the addresses from
+the 'product-info' partition, which is read-only.
+
+Reported-and-tested-by: Andreas Ziegler <ml@andreas-ziegler.de>
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+Backport of LEDE 53839da46e6fb21e68b3878b4a2187c7d32d688e
+
+diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+index 4389bc894f8dd08a9231b35bbb4fba0e9e57560b..602ce71170dac1fe0e6cb80a83cbe401836f75ff 100755
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+@@ -213,7 +213,8 @@ tl-wr1043nd-v4)
+ 	ucidef_add_switch "switch0" "1" "1"
+ 	ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
+ 	ucidef_add_switch_vlan "switch0" "2" "0t 5"
+-	mac=$(mtd_get_mac_binary config 0x1017c)
++	lan_mac=$(mtd_get_mac_binary product-info 8)
++	mac=$(macaddr_add "$lan_mac" 1)
+ 	[ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
+ 	;;
+ 
+diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
+index cb224f4611004aaaec6c3b2b737b3bb45c79d239..b1539c5d71a61806b88c50f1a78f6a27d98d7a2d 100644
+--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
+@@ -57,7 +57,7 @@
+ #define TL_WR1043_V4_KEYS_POLL_INTERVAL		20 /* msecs */
+ #define TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL	(3 * TL_WR1043_V4_KEYS_POLL_INTERVAL)
+ 
+-#define TL_WR1043_V4_MAC_LOCATION		0x1ff80174
++#define TL_WR1043_V4_MAC_LOCATION		0x1ff50008
+ 
+ #define TL_WR1043_V4_EEPROM_ADDR		0x1fff0000
+ #define TL_WR1043_V4_WMAC_CALDATA_OFFSET	0x1000