2 . /lib/functions/system.sh
3 . /lib/functions/uci-defaults.sh
4 . /lib/functions/k2t.sh
6 ath79_setup_interfaces()
13 allnet,all-wap02860ac|\
15 alfa-network,pi-wifi4|\
16 alfa-network,tube-2hq|\
17 araknis,an-300-ap-i-n|\
18 araknis,an-500-ap-i-ac|\
19 araknis,an-700-ap-i-ac|\
26 comfast,cf-wr752ac-v1|\
44 enterasys,ws-ap3705i|\
45 glinet,gl-ar300m-lite|\
47 hak5,wifi-pineapple-nano|\
73 tplink,eap225-outdoor-v1|\
84 tplink,tl-wr902ac-v1|\
86 ubnt,bullet-m-ar7240|\
87 ubnt,bullet-m-ar7241|\
90 ubnt,litebeam-ac-gen2|\
94 ubnt,nanostation-ac-loco|\
95 ubnt,nanostation-loco-m|\
96 ubnt,nanostation-loco-m-xw|\
98 ubnt,powerbeam-5ac-500|\
99 ubnt,powerbeam-5ac-gen2|\
100 ubnt,powerbeam-m2-xw|\
101 ubnt,powerbeam-m5-xw|\
103 ubnt,rocket-5ac-lite|\
109 wd,mynet-wifi-rangeextender|\
111 ucidef_set_interface_lan "eth0"
114 ucidef_add_switch "switch0" \
115 "0@eth0" "2:wan" "3:lan" "6@eth1"
117 alfa-network,ap121fe)
118 ucidef_set_interface_lan "eth0 usb0"
124 engenius,enstationac-v1|\
127 ubnt,unifi-ap-outdoor-plus)
128 ucidef_set_interface_lan "eth0 eth1"
131 ucidef_add_switch "switch0" \
132 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
133 ucidef_add_switch "switch1" \
134 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
138 tplink,archer-c58-v1|\
139 tplink,archer-c59-v1|\
140 tplink,archer-c59-v2|\
142 ucidef_set_interface_wan "eth1"
143 ucidef_add_switch "switch0" \
144 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
148 tplink,archer-c5-v1|\
149 tplink,archer-c7-v1|\
150 tplink,archer-c7-v2|\
151 tplink,tl-wdr4900-v2|\
152 tplink,tl-wdr7500-v3)
153 ucidef_add_switch "switch0" \
154 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
157 buffalo,wzr-hp-g450h)
158 ucidef_add_switch "switch0" \
159 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
163 ucidef_add_switch "switch0" \
164 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
167 buffalo,wzr-hp-ag300h|\
168 tplink,archer-c25-v1|\
169 tplink,archer-c60-v1|\
170 tplink,archer-c60-v2|\
171 tplink,archer-c60-v3|\
172 tplink,tl-wdr3500-v1|\
173 tplink,tl-wr842n-v1|\
174 tplink,tl-wr842n-v3|\
176 ucidef_set_interface_wan "eth1"
177 ucidef_add_switch "switch0" \
178 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
180 buffalo,wzr-hp-g300nh-rb|\
181 buffalo,wzr-hp-g300nh-s|\
183 ucidef_set_interface_wan "eth1"
184 ucidef_add_switch "switch0" \
185 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
187 buffalo,wzr-hp-g302h-a1a0)
188 ucidef_add_switch "switch0" \
189 "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
191 comfast,cf-e110n-v2|\
192 comfast,cf-e120a-v3|\
193 comfast,cf-e314n-v2|\
199 openmesh,om2p-hs-v4|\
212 ucidef_set_interfaces_lan_wan "eth1" "eth0"
215 ucidef_add_switch "switch0" \
216 "0@eth0" "1:wan" "2:lan"
221 tplink,tl-wr841hp-v3)
222 ucidef_set_interface_wan "eth1"
223 ucidef_add_switch "switch0" \
224 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
226 comfast,cf-wr650ac-v1|\
227 comfast,cf-wr650ac-v2|\
229 ucidef_add_switch "switch0" \
230 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
234 ucidef_add_switch "switch0" \
235 "0@eth0" "3:lan" "2:wan"
238 ucidef_add_switch "switch0" \
239 "1:wan" "5:lan" "6@eth0"
241 devolo,dlan-pro-1200plus-ac|\
243 ucidef_add_switch "switch0" \
244 "0@eth0" "2:wan" "3:lan" "4:lan"
247 ucidef_add_switch "switch0" \
248 "0@eth0" "2:lan" "3:wan" "6@eth1"
251 ucidef_add_switch "switch0" \
252 "0@eth0" "1:lan:2" "2:lan:1" "6@eth1"
255 ucidef_add_switch "switch0" \
256 "0@eth0" "1:lan:2" "2:lan:1"
266 tplink,archer-c2-v3|\
267 tplink,tl-wr1043nd-v4|\
268 tplink,tl-wr1043n-v5)
269 ucidef_add_switch "switch0" \
270 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
272 elecom,wrc-1750ghbk2-i|\
273 elecom,wrc-300ghbk2-i|\
275 ucidef_add_switch "switch0" \
276 "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
278 embeddedwireless,balin)
279 ucidef_add_switch "switch0" \
280 "0@eth0" "5:lan:1" "4:lan:2" "3:wan"
282 embeddedwireless,dorin)
283 ucidef_add_switch "switch0" \
284 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
287 ucidef_add_switch "switch0" \
290 engenius,ens202ext-v1)
291 ucidef_set_interface_lan "eth1"
292 ucidef_add_switch "switch0" \
296 ucidef_set_interface_lan "eth0" "dhcp"
299 ucidef_set_interface_wan "eth1"
300 ucidef_add_switch "switch0" \
301 "0@eth0" "1:lan" "2:lan"
304 ucidef_set_interface_wan "eth1"
305 ucidef_add_switch "switch0" \
309 iodata,wn-ac1167dgr|\
310 iodata,wn-ac1600dgr|\
311 iodata,wn-ac1600dgr2|\
315 ucidef_add_switch "switch0" \
316 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
319 ucidef_add_switch "switch0" \
320 "0@eth0" "5:wan:1" "1:lan:2" "6@eth1"
323 ucidef_set_interface_wan "eth1"
324 ucidef_add_switch "switch0" \
325 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
328 ucidef_set_interface_wan "eth0"
329 ucidef_add_switch "switch0" \
330 "0@eth1" "3:lan:2" "4:lan:1"
332 librerouter,librerouter-v1)
333 ucidef_add_switch "switch0" \
334 "0@eth0" "5:wan" "6@eth1" "4:lan"
337 ucidef_set_interface_lan "eth0"
338 ucidef_add_switch "switch0" \
342 tplink,archer-a7-v5|\
343 tplink,archer-a9-v6|\
344 tplink,archer-c6-v2|\
345 tplink,archer-c6-v2-us|\
346 tplink,archer-c7-v4|\
347 tplink,archer-c7-v5|\
348 tplink,tl-wdr3600-v1|\
349 tplink,tl-wdr4300-v1|\
350 tplink,tl-wdr4300-v1-il|\
351 tplink,tl-wdr4310-v1)
352 ucidef_add_switch "switch0" \
353 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
356 ucidef_set_interface_wan "eth1"
357 ucidef_add_switch "switch0" \
361 qxwlan,e1700ac-v2-8m|\
362 qxwlan,e1700ac-v2-16m|\
364 qxwlan,e750g-v8-16m|\
365 ubnt,nanobeam-ac-gen2|\
366 ubnt,nanostation-ac|\
369 ucidef_add_switch "switch0" \
370 "0@eth0" "2:lan" "3:wan"
374 ucidef_add_switch "switch0" \
375 "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
378 netgear,wndr3700-v2|\
383 ucidef_set_interface_wan "eth1"
384 ucidef_add_switch "switch0" \
385 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
386 ucidef_add_switch_attr "switch0" "blinkrate" 2
387 ucidef_add_switch_port_attr "switch0" 1 led 6
388 ucidef_add_switch_port_attr "switch0" 2 led 9
389 ucidef_add_switch_port_attr "switch0" 5 led 2
393 ucidef_set_interface_wan "eth0"
394 ucidef_add_switch "switch0" \
395 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
398 ucidef_add_switch "switch0" \
399 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
402 ucidef_set_interface_wan "eth1"
403 ucidef_add_switch "switch0" \
404 "0@eth0" "2:lan" "3:lan"
408 ucidef_add_switch "switch0" \
409 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
412 ucidef_add_switch "switch0" \
413 "0@eth0" "1:lan" "2:lan" "3:wan"
416 teltonika,rut955-h7v3c0)
417 ucidef_set_interface_wan "eth1"
418 ucidef_add_switch "switch0" \
419 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
421 tplink,archer-d50-v1)
422 ucidef_add_switch "switch0" \
423 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
425 tplink,archer-d7-v1|\
426 tplink,archer-d7b-v1)
427 ucidef_add_switch "switch0" \
428 "0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5"
430 tplink,eap225-wall-v2)
431 ucidef_add_switch "switch0" \
432 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
435 ucidef_add_switch "switch0" \
436 "0@eth0" "2:lan:1" "5:lan:2"
439 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0"
440 ucidef_add_switch "switch0" \
441 "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2"
443 tplink,tl-wpa8630-v1|\
444 tplink,tl-wpa8630p-v2-int|\
445 tplink,tl-wpa8630p-v2.0-eu|\
446 tplink,tl-wpa8630p-v2.1-eu)
447 # port 5 (internal) is the power-line port
448 ucidef_add_switch "switch0" \
449 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
451 tplink,tl-wr841hp-v2|\
452 tplink,tl-wr842n-v2|\
453 tplink,tl-wr941hp-v1)
454 ucidef_set_interface_wan "eth1"
455 ucidef_add_switch "switch0" \
456 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
458 tplink,tl-wr1043nd-v1)
459 ucidef_add_switch "switch0" \
460 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
462 tplink,tl-wr1043nd-v2|\
463 tplink,tl-wr1043nd-v3|\
464 tplink,tl-wr1045nd-v2)
465 ucidef_add_switch "switch0" \
466 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
469 ucidef_add_switch "switch0" \
470 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
473 ucidef_add_switch "switch0" \
474 "0@eth0" "2:lan:1" "3:lan:2" "5:lan:3" "4:wan"
477 ucidef_set_interface_wan "eth1"
478 ucidef_add_switch "switch0" \
479 "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
482 ucidef_set_interface_wan "eth1"
483 ucidef_add_switch "switch0" \
484 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
487 ucidef_set_interface_wan "eth1"
488 ucidef_add_switch "switch0" \
489 "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"
491 ubnt,routerstation-pro)
492 ucidef_set_interface_wan "eth0"
493 ucidef_add_switch "switch0" \
494 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
496 ubnt,nanostation-m-xw)
497 ucidef_add_switch "switch0" \
498 "0@eth0" "5:lan" "1:wan"
500 ubnt,unifiac-mesh-pro|\
502 ucidef_add_switch "switch0" \
503 "0@eth0" "2:lan:1" "3:lan:2"
506 ucidef_add_switch "switch0" \
507 "0@eth0" "1:lan" "2:lan"
509 xiaomi,mi-router-4q|\
511 ucidef_set_interface_wan "eth1"
512 ucidef_add_switch "switch0" \
513 "0@eth0" "3:lan:1" "4:lan:2"
516 ucidef_set_interfaces_lan_wan "eth0" "eth1"
528 lan_mac=$(mtd_get_mac_binary "Board data" 2)
531 alfa-network,ap121f|\
532 alfa-network,ap121fe|\
535 alfa-network,pi-wifi4|\
537 alfa-network,tube-2hq|\
539 engenius,ens202ext-v1)
540 label_mac=$(mtd_get_mac_binary art 0x1002)
543 base_mac=$(mtd_get_mac_binary art 0x1002)
544 lan_mac=$(macaddr_setbit $base_mac 29)
545 [ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
550 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
553 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
554 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
557 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
558 wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)"))
561 wan_mac=$(macaddr_add $(mtd_get_mac_binary art 0x0) 1)
566 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
568 devolo,dlan-pro-1200plus-ac|\
570 label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3)
575 lan_mac=$(mtd_get_mac_text "mp" 0x1)
582 lan_mac=$(mtd_get_mac_ascii bdcfg "lanmac")
587 label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
590 lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
591 wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
594 lan_mac=$(mtd_get_mac_text "mac" 0x4)
598 lan_mac=$(mtd_get_mac_text "mac" 0x4)
599 wan_mac=$(mtd_get_mac_text "mac" 0x18)
604 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
605 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
612 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
613 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
615 elecom,wrc-1750ghbk2-i|\
616 elecom,wrc-300ghbk2-i)
617 wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2)
621 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
625 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
626 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
629 lan_mac=$(mtd_get_mac_text "u-boot-env" 0xe9)
630 eth1_mac=$(macaddr_add "$lan_mac" 1)
631 ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac"
632 ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac"
634 enterasys,ws-ap3705i)
635 label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr)
638 hak5,packet-squirrel)
639 label_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
642 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
643 wan_mac=$(macaddr_add "$lan_mac" -1)
646 iodata,wn-ac1167dgr|\
647 iodata,wn-ac1600dgr|\
648 iodata,wn-ac1600dgr2|\
650 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
651 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
655 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
656 lan_mac=$(macaddr_add "$wan_mac" 1)
659 tplink,tl-wdr3600-v1|\
660 tplink,tl-wdr4300-v1|\
661 tplink,tl-wdr4300-v1-il)
662 base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
663 wan_mac=$(macaddr_add "$base_mac" 1)
667 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
668 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
672 lan_mac=$(mtd_get_mac_text board_data 0x280)
673 wan_mac=$(mtd_get_mac_text board_data 0x480)
677 netgear,wndr3700-v2|\
681 lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)")
684 lan_mac=$(k2t_get_mac "lan_mac")
685 wan_mac=$(k2t_get_mac "wan_mac")
688 wan_mac=$(mtd_get_mac_binary factory 0x0)
689 lan_mac=$(macaddr_setbit_la "$wan_mac")
693 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
694 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
697 tplink,archer-a7-v5|\
698 tplink,archer-a9-v6|\
699 tplink,archer-c7-v4|\
700 tplink,archer-c7-v5|\
701 tplink,tl-wr1043nd-v4|\
702 tplink,tl-wr1043n-v5)
703 base_mac=$(mtd_get_mac_binary info 0x8)
704 wan_mac=$(macaddr_add "$base_mac" 1)
707 lan_mac=$(mtd_get_mac_text mac 0x4)
708 wan_mac=$(mtd_get_mac_text mac 0x18)
712 ubnt,bullet-m-ar7240|\
713 ubnt,bullet-m-ar7241|\
715 ubnt,nanostation-loco-m|\
721 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
723 ubnt,litebeam-ac-gen2|\
724 ubnt,nanobeam-ac-gen2|\
725 ubnt,nanobeam-ac-xc|\
726 ubnt,powerbeam-5ac-500|\
727 ubnt,powerbeam-5ac-gen2)
728 label_mac=$(mtd_get_mac_binary art 0x5006)
731 ubnt,routerstation-pro)
732 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
733 lan_mac=$(macaddr_add "$wan_mac" 1)
735 wd,mynet-wifi-rangeextender)
736 lan_mac=$(nvram get et0macaddr)
739 lan_mac=$(mtd_get_mac_binary art 0x1002)
742 label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
746 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
747 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
748 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
753 ath79_setup_interfaces $board
754 ath79_setup_macs $board