From ed975a58e43db95748e3a23039d84a50f79712e0 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 8 Dec 2019 13:42:39 +0100 Subject: [PATCH] ramips: mt7621: use flash location for wan_mac in 02_network This uses the flash locations instead of eth0 MAC address to calculate MAC address increments for WAN. The change will make the MAC address setup of a particular device more obvious and removes the dependency of 02_network on the eth0 initialization. Signed-off-by: Adrian Schmutzler --- .../mt7621/base-files/etc/board.d/02_network | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index e7e225a148..2828cf67dc 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -147,30 +147,21 @@ ramips_setup_macs() local label_mac="" case $board in - adslr,g7|\ + adslr,g7) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe00c)" 1) + ;; afoundry,ew1200|\ asiarf,ap7621-001|\ asiarf,ap7621-nv1|\ firefly,firewrt|\ gehua,ghl-r-001|\ - mediatek,ap-mt7621a-v60|\ - mikrotik,rb750gr3|\ - mikrotik,rbm33g|\ mqmaker,witi|\ - mtc,wr1201|\ - netgear,r6220|\ - netgear,wndr3700-v5|\ - storylink,sap-g3200u3|\ - telco-electronics,x1|\ totolink,a7000r|\ - ubiquiti,edgerouterx|\ - ubiquiti,edgerouterx-sfp|\ unielec,u7621-06-16m|\ unielec,u7621-06-64m|\ - xiaoyu,xy-c5|\ xzwifi,creativebox-v1|\ zbtlink,zbt-wg2626) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe000)" 1) ;; alfa-network,quad-e4g|\ asus,rt-ac57u|\ @@ -215,17 +206,36 @@ ramips_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) ;; iodata,wn-ax1167gr|\ - iodata,wn-gx300gr) + iodata,wn-gx300gr|\ + mtc,wr1201|\ + netgear,r6220|\ + netgear,wndr3700-v5|\ + xiaoyu,xy-c5) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; iodata,wnpr2600g) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; + mediatek,ap-mt7621a-v60) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x5)" 1) + ;; + mikrotik,rb750gr3|\ + mikrotik,rbm33g) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary hard_config 0x10)" 2) + ;; netgear,r6260|\ netgear,r6350|\ netgear,r6850) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 2) + ;; + storylink,sap-g3200u3|\ + telco-electronics,x1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe006)" 1) + ;; + ubiquiti,edgerouterx|\ + ubiquiti,edgerouterx-sfp) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x22)" 1) ;; wevo,11acnas|\ wevo,w2914ns-v2) @@ -249,7 +259,7 @@ ramips_setup_macs() ;; zbtlink,zbt-wg3526-16m|\ zbtlink,zbt-wg3526-32m) - wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe000)" 1) label_mac=$(mtd_get_mac_binary factory 0x4) ;; esac -- 2.25.1