summaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/base-files/etc/board.d/02_network
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2019-08-15 15:13:33 +0200
committerPetr Štetiar <ynezz@true.cz>2019-09-19 23:43:27 +0200
commit50fdc0374b75584f19c75f712ca0472a7113a065 (patch)
treea279896d5fd47dbe8fd2fcf52fca9e9bdc21278e /target/linux/ath79/base-files/etc/board.d/02_network
parent469e347f19ce9eefdc16f421b8e1f18ed60c310c (diff)
downloadopenwrt-50fdc0374b75584f19c75f712ca0472a7113a065.tar.gz
openwrt-50fdc0374b75584f19c75f712ca0472a7113a065.tar.bz2
openwrt-50fdc0374b75584f19c75f712ca0472a7113a065.zip
ath79: provide label MAC address
This patch adds the label MAC address for several devices in ath79. Some devices require setting the MAC address in 02_network: For the following devices, the netif device can be linked in device tree, but the MAC address cannot be read: - alfa-network,ap121f - avm,fritz300e - ubnt-xm devices For the following devices, label MAC address is tied to lan or wan, so no node to link to exists in device tree: - adtran,bsap1800-v2 - adtran,bsap1840 - dlink,dir-842-c1/-c2/-c3 - engenius,ecb1750 - iodata,etg3-r - iodata,wn-ac1167dgr - iodata,wn-ac1600dgr - iodata,wn-ac1600dgr2 - iodata,wn-ag300dgr - nec,wg800hp - nec,wg1200cr - trendnet,tew-823dru Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/ath79/base-files/etc/board.d/02_network')
-rwxr-xr-xtarget/linux/ath79/base-files/etc/board.d/02_network40
1 files changed, 30 insertions, 10 deletions
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 5b47af8ef7..2ed4ee010c 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -314,9 +314,19 @@ ath79_setup_macs()
adtran,bsap1800-v2|\
adtran,bsap1840)
lan_mac=$(mtd_get_mac_binary "Board data" 2)
+ label_mac=$lan_mac
+ ;;
+ alfa-network,ap121f|\
+ ubnt,airrouter|\
+ ubnt,bullet-m|\
+ ubnt,nanostation-m|\
+ ubnt,rocket-m|\
+ ubnt,unifi)
+ label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
;;
avm,fritz300e)
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
+ label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
;;
avm,fritz4020)
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
@@ -334,8 +344,13 @@ ath79_setup_macs()
dlink,dir-842-c1|\
dlink,dir-842-c2|\
dlink,dir-842-c3|\
+ nec,wg1200cr)
+ lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
+ wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
+ label_mac=$lan_mac
+ ;;
dlink,dir-859-a1|\
- nec,wg1200cr|\
+ qihoo,c301|\
wd,mynet-n750)
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
@@ -346,12 +361,9 @@ ath79_setup_macs()
;;
engenius,ecb1750)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+ label_mac=$(mtd_get_mac_ascii u-boot-env athaddr)
;;
- engenius,epg5000|\
- iodata,wn-ac1167dgr|\
- iodata,wn-ac1600dgr|\
- iodata,wn-ac1600dgr2|\
- iodata,wn-ag300dgr)
+ engenius,epg5000)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
;;
@@ -364,6 +376,15 @@ ath79_setup_macs()
iodata,etg3-r)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" -1)
+ label_mac=$wan_mac
+ ;;
+ iodata,wn-ac1167dgr|\
+ iodata,wn-ac1600dgr|\
+ iodata,wn-ac1600dgr2|\
+ iodata,wn-ag300dgr)
+ lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+ wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
+ label_mac=$wan_mac
;;
jjplus,ja76pf2)
wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
@@ -372,6 +393,7 @@ ath79_setup_macs()
nec,wg800hp)
lan_mac=$(mtd_get_mac_text board_data 0x280)
wan_mac=$(mtd_get_mac_text board_data 0x480)
+ label_mac=$wan_mac
;;
netgear,wndr3700|\
netgear,wndr3700v2|\
@@ -382,10 +404,6 @@ ath79_setup_macs()
lan_mac=$(k2t_get_mac "lan_mac")
wan_mac=$(k2t_get_mac "wan_mac")
;;
- qihoo,c301)
- lan_mac=$(mtd_get_mac_ascii devdata lanmac)
- wan_mac=$(mtd_get_mac_ascii devdata wanmac)
- ;;
rosinson,wr818)
wan_mac=$(mtd_get_mac_binary factory 0x0)
lan_mac=$(macaddr_setbit_la "$wan_mac")
@@ -406,6 +424,7 @@ ath79_setup_macs()
trendnet,tew-823dru)
lan_mac=$(mtd_get_mac_text mac 0x4)
wan_mac=$(mtd_get_mac_text mac 0x18)
+ label_mac=$wan_mac
;;
ubnt,routerstation|\
ubnt,routerstation-pro)
@@ -419,6 +438,7 @@ ath79_setup_macs()
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
}
board_config_update