. /lib/functions/system.sh . /lib/functions/uci-defaults.sh . /lib/functions/k2t.sh ath79_setup_interfaces() { local board="$1" case "$board" in adtran,bsap1800-v2|\ adtran,bsap1840|\ allnet,all-wap02860ac|\ alfa-network,ap121f|\ alfa-network,pi-wifi4|\ alfa-network,tube-2hq|\ araknis,an-300-ap-i-n|\ araknis,an-500-ap-i-ac|\ araknis,an-700-ap-i-ac|\ arduino,yun|\ aruba,ap-105|\ aruba,ap-175|\ asus,rp-ac51|\ asus,rp-ac66|\ avm,fritz1750e|\ avm,fritz300e|\ avm,fritzdvbc|\ comfast,cf-wr752ac-v1|\ comfast,cf-e130n-v2|\ devolo,dvl1200i|\ devolo,dvl1750c|\ devolo,dvl1750i|\ devolo,dvl1750x|\ dlink,dap-1330-a1|\ dlink,dap-1365-a1|\ dlink,dap-2230-a1|\ dlink,dap-2660-a1|\ dlink,dap-2680-a1|\ dlink,dap-3320-a1|\ dlink,dir-505|\ engenius,eap1200h|\ engenius,eap1750h|\ engenius,eap600|\ engenius,ecb1200|\ engenius,ecb1750|\ engenius,ecb600|\ enterasys,ws-ap3705i|\ extreme-networks,ws-ap3805i|\ fortinet,fap-221-b|\ glinet,gl-ar300m-lite|\ glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ meraki,mr16|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndap360|\ ocedo,koala|\ ocedo,raccoon|\ onion,omega|\ openmesh,mr600-v1|\ openmesh,mr600-v2|\ openmesh,mr900-v1|\ openmesh,mr900-v2|\ openmesh,mr1750-v1|\ openmesh,mr1750-v2|\ pcs,cap324|\ pisen,ts-d084|\ pisen,wmb001n|\ pisen,wmm003n|\ ruckus,zf7321|\ ruckus,zf7341|\ ruckus,zf7351|\ siemens,ws-ap3610|\ sophos,ap15|\ sophos,ap55|\ sophos,ap55c|\ sophos,ap100|\ sophos,ap100c|\ tplink,cpe210-v2|\ tplink,cpe210-v3|\ tplink,cpe510-v2|\ tplink,cpe510-v3|\ tplink,cpe605-v1|\ tplink,cpe610-v1|\ tplink,cpe610-v2|\ tplink,cpe710-v1|\ tplink,eap225-outdoor-v1|\ tplink,eap225-outdoor-v3|\ tplink,eap225-v1|\ tplink,eap225-v3|\ tplink,eap225-v4|\ tplink,eap245-v1|\ tplink,re350k-v1|\ tplink,re355-v1|\ tplink,re450-v1|\ tplink,re450-v2|\ tplink,re450-v3|\ tplink,re455-v1|\ tplink,tl-wa1201-v2|\ tplink,tl-wr902ac-v1|\ ubnt,bullet-ac|\ ubnt,bullet-m-xw|\ ubnt,lap-120|\ ubnt,litebeam-ac-gen2|\ ubnt,nanobeam-ac|\ ubnt,nanobeam-ac-xc|\ ubnt,nanostation-ac-loco|\ ubnt,nanostation-loco-m-xw|\ ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ ubnt,powerbeam-m2-xw|\ ubnt,powerbeam-m5-xw|\ ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ ubnt,uk-ultra|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ ubnt,unifiac-mesh|\ ubnt,unifi|\ watchguard,ap100|\ watchguard,ap200|\ watchguard,ap300|\ wd,mynet-wifi-rangeextender|\ winchannel,wb2000|\ zyxel,nwa1100-nh|\ zyxel,nwa1121-ni|\ zyxel,nwa1123-ac|\ zyxel,nwa1123-ni) ucidef_set_interface_lan "eth0" ;; airtight,c-75) ucidef_add_switch "switch0" \ "0@eth0" "2:wan" "3:lan" "6@eth1" ;; alfa-network,ap121fe) ucidef_set_interface_lan "eth0 usb0" ;; alfa-network,n2q|\ alfa-network,n5q|\ devolo,dvl1200e|\ devolo,dvl1750e|\ engenius,enstationac-v1|\ engenius,ews511ap|\ engenius,ews660ap|\ ocedo,ursus|\ ruckus,zf7363|\ ruckus,zf7372|\ ubnt,unifi-ap-outdoor-plus) ucidef_set_interface_lan "eth0 eth1" ;; asus,pl-ac56) # port 6 (internal) is the power-line port ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "6:lan:4" ;; atheros,db120) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" ucidef_add_switch "switch1" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" ;; avm,fritz4020|\ pcs,cr3000|\ tplink,archer-c58-v1|\ tplink,archer-c59-v1|\ tplink,archer-c59-v2|\ wd,mynet-n600) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" ;; belkin,f9j1108-v2|\ belkin,f9k1115-v2|\ tplink,archer-c5-v1|\ tplink,archer-c7-v1|\ tplink,archer-c7-v2|\ tplink,tl-wdr4900-v2|\ tplink,tl-wdr7500-v3) ucidef_add_switch "switch0" \ "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan" ;; buffalo,bhr-4grv|\ buffalo,wzr-hp-g450h) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" ;; buffalo,bhr-4grv2|\ trendnet,tew-823dru) ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0" ;; buffalo,wzr-600dhp|\ buffalo,wzr-hp-ag300h|\ tplink,archer-c25-v1|\ tplink,archer-c60-v1|\ tplink,archer-c60-v2|\ tplink,archer-c60-v3|\ tplink,tl-wdr3500-v1|\ tplink,tl-wr842n-v1|\ tplink,tl-wr842n-v3) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; teltonika,rut300) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" ;; buffalo,wzr-hp-g300nh-rb|\ buffalo,wzr-hp-g300nh-s|\ dlink,dir-825-b1|\ trendnet,tew-673gru) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0" ;; buffalo,wzr-hp-g302h-a1a0) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan" ;; alcatel,hh40v|\ comfast,cf-e110n-v2|\ comfast,cf-e120a-v3|\ comfast,cf-e314n-v2|\ compex,wpj531-16m|\ openmesh,a40|\ openmesh,a60|\ openmesh,om2p-v1|\ openmesh,om2p-v4|\ openmesh,om2p-hs-v4|\ plasmacloud,pa300|\ plasmacloud,pa300e|\ tplink,cpe210-v1|\ tplink,cpe220-v2|\ tplink,cpe220-v3|\ tplink,cpe510-v1|\ tplink,wbs210-v1|\ tplink,wbs210-v2|\ tplink,wbs510-v1|\ tplink,wbs510-v2|\ ubnt,routerstation) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; comfast,cf-e375ac) ucidef_add_switch "switch0" \ "0@eth0" "1:wan" "2:lan" ;; comfast,cf-e560ac|\ qca,ap143-8m|\ qca,ap143-16m|\ tplink,tl-wr841hp-v3) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; comfast,cf-wr650ac-v1|\ comfast,cf-wr650ac-v2|\ zyxel,nbg6616) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1" ;; compex,wpj344-16m|\ compex,wpj563) ucidef_add_switch "switch0" \ "0@eth0" "3:lan" "2:wan" ;; compex,wpj558-16m) ucidef_add_switch "switch0" \ "1:wan" "5:lan" "6@eth0" ;; devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi) ucidef_add_switch "switch0" \ "0@eth0" "2:wan" "3:lan" "4:lan" ;; dlink,dap-2695-a1) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:wan" "6@eth1" ;; dlink,dap-3662-a1) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:2" "2:lan:1" "6@eth1" ;; dlink,dch-g020-a1) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:2" "2:lan:1" ;; dlink,dir-629-a1|\ dlink,dir-825-c1|\ dlink,dir-835-a1|\ dlink,dir-842-c1|\ dlink,dir-842-c2|\ dlink,dir-842-c3|\ dlink,dir-859-a1|\ dlink,dir-859-a3|\ dlink,dir-869-a1|\ engenius,epg5000|\ engenius,esr1200|\ engenius,esr1750|\ engenius,esr900|\ sitecom,wlr-7100|\ tplink,archer-c2-v3|\ tplink,tl-wr1043nd-v4|\ tplink,tl-wr1043n-v5) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" ;; elecom,wrc-1750ghbk2-i|\ elecom,wrc-300ghbk2-i|\ sitecom,wlr-8100) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan" ;; embeddedwireless,balin) ucidef_add_switch "switch0" \ "0@eth0" "5:lan:1" "4:lan:2" "3:wan" ;; embeddedwireless,dorin) ucidef_add_switch "switch0" \ "0@eth0" "1:wan" "2:lan:3" "3:lan:2" ;; engenius,eap300-v2) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" ;; engenius,ens202ext-v1) ucidef_set_interface_lan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan" ;; etactica,eg200) ucidef_set_interface_lan "eth0" "dhcp" ;; glinet,gl-ar750) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" ;; glinet,gl-x300b) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "4:lan" ;; iodata,etg3-r|\ iodata,wn-ac1167dgr|\ iodata,wn-ac1600dgr|\ iodata,wn-ac1600dgr2|\ iodata,wn-ag300dgr|\ pcs,cr5000|\ wd,mynet-n750) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" ;; jjplus,jwap230) ucidef_add_switch "switch0" \ "0@eth0" "5:wan:1" "1:lan:2" "6@eth1" ;; joyit,jt-or750i) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" ;; kuwfi,c910) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:2" "4:lan:1" ;; letv,lba-047-ch) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "3:lan:2" "4:lan:1" ;; librerouter,librerouter-v1) ucidef_add_switch "switch0" \ "0@eth0" "5:wan" "6@eth1" "4:lan" ;; meraki,mr12) ucidef_set_interface_lan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "1:lan" ;; mercury,mw4530r-v1|\ tplink,archer-a7-v5|\ tplink,archer-a9-v6|\ tplink,archer-c6-v2|\ tplink,archer-c6-v2-us|\ tplink,archer-c7-v4|\ tplink,archer-c7-v5|\ tplink,tl-wdr3600-v1|\ tplink,tl-wdr4300-v1|\ tplink,tl-wdr4300-v1-il|\ tplink,tl-wdr4310-v1) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" ;; nec,wf1200cr) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan" ;; nec,wg1200cr|\ qxwlan,e1700ac-v2-8m|\ qxwlan,e1700ac-v2-16m|\ qxwlan,e750g-v8-8m|\ qxwlan,e750g-v8-16m|\ ubnt,nanobeam-ac-gen2|\ ubnt,nanostation-ac|\ yuncore,a782|\ yuncore,xd3200|\ yuncore,xd4200) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:wan" ;; nec,wg800hp|\ xiaomi,aiot-ac2350) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan" ;; netgear,wndr3700|\ netgear,wndr3700-v2|\ netgear,wndr3800|\ netgear,wndr3800ch|\ netgear,wndrmac-v1|\ netgear,wndrmac-v2) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0" ucidef_add_switch_attr "switch0" "blinkrate" 2 ucidef_add_switch_port_attr "switch0" 1 led 6 ucidef_add_switch_port_attr "switch0" 2 led 9 ucidef_add_switch_port_attr "switch0" 5 led 2 ;; netgear,wnr2200-8m|\ netgear,wnr2200-16m) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" ;; phicomm,k2t) ucidef_add_switch "switch0" \ "0@eth0" "3:lan:1" "5:lan:2" "4:wan" ;; qihoo,c301) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" ;; qxwlan,e558-v2-8m|\ qxwlan,e558-v2-16m) ucidef_add_switch "switch0" \ "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan" ;; rosinson,wr818) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:wan" ;; ruckus,zf7025) ucidef_set_interface_lan "eth0 eth1" ucidef_add_switch "switch0" \ "0u@eth1" "4:lan:1" "3:lan:2" "2:lan:3" "1:lan:4" ;; teltonika,rut955|\ teltonika,rut955-h7v3c0) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" ;; tplink,archer-d50-v1) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan" ;; tplink,archer-d7-v1|\ tplink,archer-d7b-v1) ucidef_add_switch "switch0" \ "0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5" ;; tplink,eap225-wall-v2) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; tplink,eap245-v3) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "5:lan:2" ;; tplink,tl-mr6400-v1) ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2" ;; tplink,tl-wpa8630-v1) # port 5 (internal) is the power-line port ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4" ;; tplink,tl-wr841hp-v2|\ tplink,tl-wr842n-v2|\ tplink,tl-wr941hp-v1) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; tplink,tl-wr1043nd-v1) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" ;; tplink,tl-wr1043nd-v2|\ tplink,tl-wr1043nd-v3|\ tplink,tl-wr1045nd-v2) ucidef_add_switch "switch0" \ "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0" ;; tplink,tl-wr2543-v1) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0" ;; ubnt,aircube-ac) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:2" "5:lan:3" "4:wan" ;; ubnt,aircube-isp) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2" ;; ubnt,edgeswitch-5xp) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" ;; ubnt,edgeswitch-8xp) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:lan:5" "5:lan:6" "6:lan:7" "7:lan:8" "8@eth0" ;; ubnt,routerstation-pro) ucidef_set_interface_wan "eth0" ucidef_add_switch "switch0" \ "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1" ;; ubnt,nanostation-m-xw) ucidef_add_switch "switch0" \ "0@eth0" "5:lan" "1:wan" ;; ubnt,unifiac-mesh-pro|\ ubnt,unifiac-pro) ucidef_add_switch "switch0" \ "0@eth0" "2:lan:1" "3:lan:2" ;; ubnt,unifi-ap-pro) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" ;; tplink,deco-m4r-v1|\ tplink,deco-s4-v2) ucidef_add_switch "switch0" \ "0@eth0" "3:lan:1" "5:lan:2" ;; hiwifi,hc6361|\ xiaomi,mi-router-4q|\ zbtlink,zbt-wd323) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "3:lan:1" "4:lan:2" ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; esac } ath79_setup_macs() { local board="$1" case "$board" in adtran,bsap1800-v2|\ adtran,bsap1840) lan_mac=$(mtd_get_mac_binary "Board data" 2) label_mac=$lan_mac ;; alfa-network,ap121f|\ alfa-network,ap121fe|\ alfa-network,n2q|\ alfa-network,n5q|\ alfa-network,pi-wifi4|\ alfa-network,r36a|\ alfa-network,tube-2hq|\ engenius,eap300-v2|\ engenius,ens202ext-v1) label_mac=$(mtd_get_mac_binary art 0x1002) ;; arduino,yun) base_mac=$(mtd_get_mac_binary art 0x1002) lan_mac=$(macaddr_setbit $base_mac 29) [ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29) ;; avm,fritz1750e|\ avm,fritz450e|\ avm,fritzdvbc) label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)")) ;; avm,fritz300e) lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)")) ;; avm,fritz4020) lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)")) ;; comfast,cf-e375ac) wan_mac=$(macaddr_add $(mtd_get_mac_binary art 0x0) 1) ;; compex,wpj344-16m|\ compex,wpj558-16m|\ compex,wpj563) wan_mac=$(mtd_get_mac_binary u-boot 0x2e018) ;; devolo,dlan-pro-1200plus-ac|\ devolo,magic-2-wifi) label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3) ;; dlink,dap-1330-a1|\ dlink,dap-1365-a1|\ dlink,dch-g020-a1) lan_mac=$(mtd_get_mac_text "mp" 0x1) label_mac=$lan_mac ;; dlink,dap-2230-a1|\ dlink,dap-2660-a1|\ dlink,dap-2680-a1|\ dlink,dap-3320-a1) lan_mac=$(mtd_get_mac_ascii bdcfg "lanmac") label_mac=$lan_mac ;; dlink,dap-2695-a1|\ dlink,dap-3662-a1) label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac") ;; dlink,dir-629-a1) wan_mac=$(mtd_get_mac_text "mfcdata" 0x6a) ;; trendnet,tew-673gru) lan_mac=$(mtd_get_mac_text "caldata" 0xffa0) wan_mac=$(mtd_get_mac_text "caldata" 0xffb4) label_mac=$wan_mac ;; dlink,dir-505) lan_mac=$(mtd_get_mac_text "mac" 0x4) ;; dlink,dir-825-c1|\ dlink,dir-835-a1) wan_mac=$(mtd_get_mac_text "mac" 0x18) ;; dlink,dir-842-c1|\ dlink,dir-842-c2|\ dlink,dir-842-c3) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") label_mac=$lan_mac ;; dlink,dir-859-a1|\ dlink,dir-869-a1) lan_mac=$(mtd_get_mac_text "devdata" 0xc9) wan_mac=$(mtd_get_mac_text "devdata" 0x79) ;; dlink,dir-859-a3) lan_mac=$(get_mac_label) wan_mac=$(macaddr_add "$lan_mac" 3) ;; qihoo,c301|\ wd,mynet-n600|\ wd,mynet-n750) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") ;; elecom,wrc-1750ghbk2-i|\ elecom,wrc-300ghbk2-i) wan_mac=$(mtd_get_mac_ascii hwconfig "HW.WAN.MAC.Address") label_mac=$wan_mac ;; engenius,ecb1200|\ engenius,ecb1750) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) label_mac=$lan_mac ;; engenius,epg5000|\ engenius,esr1200|\ engenius,esr1750|\ engenius,esr900) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) ;; engenius,ews511ap) lan_mac=$(mtd_get_mac_text "u-boot-env" 0xe9) eth1_mac=$(macaddr_add "$lan_mac" 1) ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac" ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac" ;; enterasys,ws-ap3705i) label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr) ;; fortinet,fap-221-b) lan_mac=$(mtd_get_mac_text u-boot 0x3ff80 12) label_mac=$lan_mac ;; hak5,lan-turtle|\ hak5,packet-squirrel) label_mac=$(mtd_get_mac_binary u-boot 0x1fc00) ;; 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 ;; mercury,mw4530r-v1|\ tplink,tl-wdr3600-v1|\ tplink,tl-wdr4300-v1|\ tplink,tl-wdr4300-v1-il) base_mac=$(mtd_get_mac_binary u-boot 0x1fc00) wan_mac=$(macaddr_add "$base_mac" 1) ;; tplink,deco-s4-v2) lan_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) label_mac=$lan_mac ;; nec,wf1200cr|\ nec,wg1200cr) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") label_mac=$wan_mac ;; 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,wndr3700-v2|\ netgear,wndr3800|\ netgear,wndrmac-v1|\ netgear,wndrmac-v2) lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)") ;; phicomm,k2t) lan_mac=$(k2t_get_mac "lan_mac") wan_mac=$(k2t_get_mac "wan_mac") ;; rosinson,wr818) wan_mac=$(mtd_get_mac_binary factory 0x0) lan_mac=$(macaddr_setbit_la "$wan_mac") ;; ruckus,zf7025|\ ruckus,zf7321|\ ruckus,zf7341|\ ruckus,zf7351|\ ruckus,zf7363|\ ruckus,zf7372) lan_mac=$(mtd_get_mac_binary board-data 0x807E) label_mac=$lan_mac ;; sitecom,wlr-7100|\ sitecom,wlr-8100) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$lan_mac ;; tplink,archer-a7-v5|\ tplink,archer-a9-v6|\ tplink,archer-c7-v4|\ tplink,archer-c7-v5|\ tplink,tl-wr1043nd-v4|\ tplink,tl-wr1043n-v5) base_mac=$(mtd_get_mac_binary info 0x8) wan_mac=$(macaddr_add "$base_mac" 1) ;; trendnet,tew-823dru) lan_mac=$(mtd_get_mac_text mac 0x4) wan_mac=$(mtd_get_mac_text mac 0x18) label_mac=$wan_mac ;; ubnt,powerbridge-m|\ ubnt,rocket-m|\ ubnt,unifi) label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; ubnt,litebeam-ac-gen2|\ ubnt,nanobeam-ac-gen2|\ ubnt,nanobeam-ac-xc|\ ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2) label_mac=$(mtd_get_mac_binary art 0x5006) ;; ubnt,routerstation|\ ubnt,routerstation-pro) wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa) lan_mac=$(macaddr_add "$wan_mac" 1) ;; wd,mynet-wifi-rangeextender) lan_mac=$(nvram get et0macaddr) ;; xiaomi,aiot-ac2350) lan_mac=$(mtd_get_mac_binary art 0x1002) ;; zyxel,nbg6616) label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) ;; esac [ -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 board=$(board_name) ath79_setup_interfaces $board ath79_setup_macs $board board_config_flush exit 0