3 .
/lib
/functions
/system.sh
4 .
/lib
/functions
/uci-defaults.sh
5 .
/lib
/functions
/k2t.sh
7 ath79_setup_interfaces
()
14 allnet
,all-wap02860ac|\
21 comfast
,cf-wr752ac-v1|\
31 enterasys
,ws-ap3705i|\
32 glinet
,gl-ar300m-lite|\
33 hak5
,wifi-pineapple-nano|\
55 tplink
,tl-wr902ac-v1|\
56 ubnt
,bullet-m-ar7240|\
57 ubnt
,bullet-m-ar7241|\
60 ubnt
,litebeam-ac-gen2|\
63 ubnt
,nanostation-ac-loco|\
64 ubnt
,nanostation-loco-m|\
65 ubnt
,nanostation-loco-m-xw|\
67 ubnt
,powerbeam-5ac-500|\
68 ubnt
,powerbeam-5ac-gen2|\
75 wd
,mynet-wifi-rangeextender|\
77 ucidef_set_interface_lan
"eth0"
80 ucidef_set_interface_lan
"eth0 usb0"
87 ucidef_set_interface_lan
"eth0 eth1"
91 tplink
,archer-c58-v1|\
92 tplink
,archer-c59-v1|\
94 ucidef_set_interface_wan
"eth1"
95 ucidef_add_switch
"switch0" \
96 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
100 ucidef_add_switch
"switch0" \
101 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
105 ucidef_add_switch
"switch0" \
106 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
109 buffalo
,wzr-hp-ag300h|\
110 tplink
,archer-c25-v1|\
111 tplink
,archer-c60-v1|\
112 tplink
,archer-c60-v2|\
113 tplink
,archer-c60-v3|\
114 tplink
,tl-wdr3500-v1|\
115 tplink
,tl-wr842n-v1|\
116 tplink
,tl-wr842n-v3|\
118 ucidef_set_interface_wan
"eth1"
119 ucidef_add_switch
"switch0" \
120 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
122 buffalo
,wzr-hp-g302h-a1a0
)
123 ucidef_add_switch
"switch0" \
124 "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
126 comfast
,cf-e110n-v2|\
127 comfast
,cf-e120a-v3|\
128 comfast
,cf-e314n-v2|\
140 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
143 ucidef_set_interface_wan
"eth1"
144 ucidef_add_switch
"switch0" \
145 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
147 comfast
,cf-wr650ac-v1|\
148 comfast
,cf-wr650ac-v2|\
150 ucidef_add_switch
"switch0" \
151 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
155 ucidef_add_switch
"switch0" \
156 "0@eth0" "3:lan" "2:wan"
159 ucidef_add_switch
"switch0" \
160 "0@eth0" "2:wan" "3:lan" "4:lan"
163 ucidef_add_switch
"switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
166 ucidef_add_switch
"switch0" \
167 "0@eth0" "1:lan:2" "2:lan:1"
170 ucidef_set_interface_wan
"eth1"
171 ucidef_add_switch
"switch0" \
172 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
181 tplink
,archer-c2-v3|\
182 tplink
,tl-wr1043nd-v4|\
183 tplink
,tl-wr1043n-v5
)
184 ucidef_add_switch
"switch0" \
185 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
187 elecom
,wrc-1750ghbk2-i|\
188 elecom
,wrc-300ghbk2-i|\
190 ucidef_add_switch
"switch0" \
191 "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
193 embeddedwireless
,dorin
)
194 ucidef_add_switch
"switch0" \
195 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
198 ucidef_set_interface_wan
"eth0"
199 ucidef_add_switch
"switch0" \
202 engenius
,ens202ext-v1
)
203 ucidef_set_interface_wan
"eth1"
204 ucidef_add_switch
"switch0" \
208 ucidef_set_interface_lan
"eth0 eth1" "dhcp"
211 ucidef_set_interface_lan
"eth0" "dhcp"
214 ucidef_set_interface_wan
"eth1"
215 ucidef_add_switch
"switch0" \
216 "0@eth0" "1:lan" "2:lan"
219 iodata
,wn-ac1167dgr|\
220 iodata
,wn-ac1600dgr|\
221 iodata
,wn-ac1600dgr2|\
226 ucidef_add_switch
"switch0" \
227 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
229 librerouter
,librerouter-v1
)
230 ucidef_add_switch
"switch0" \
231 "0@eth0" "5:wan" "6@eth1" "4:lan"
234 tplink
,archer-a7-v5|\
235 tplink
,archer-c6-v2|\
236 tplink
,archer-c6-v2-us|\
237 tplink
,archer-c7-v4|\
238 tplink
,archer-c7-v5|\
239 tplink
,tl-wdr3600-v1|\
240 tplink
,tl-wdr4300-v1|\
241 tplink
,tl-wdr4300-v1-il|\
242 tplink
,tl-wdr4310-v1
)
243 ucidef_add_switch
"switch0" \
244 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
248 qxwlan
,e750g-v8-16m|\
249 ubnt
,nanostation-ac|\
252 ucidef_add_switch
"switch0" \
253 "0@eth0" "2:lan" "3:wan"
256 ucidef_add_switch
"switch0" \
257 "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
260 netgear
,wndr3700-v2|\
265 ucidef_set_interface_wan
"eth1"
266 ucidef_add_switch
"switch0" \
267 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
268 ucidef_add_switch_attr
"switch0" "blinkrate" 2
269 ucidef_add_switch_port_attr
"switch0" 1 led
6
270 ucidef_add_switch_port_attr
"switch0" 2 led
9
271 ucidef_add_switch_port_attr
"switch0" 5 led
2
275 ucidef_set_interface_wan
"eth0"
276 ucidef_add_switch
"switch0" \
277 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
280 ucidef_add_switch
"switch0" \
281 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
284 ucidef_set_interface_wan
"eth1"
285 ucidef_add_switch
"switch0" \
286 "0@eth0" "2:lan" "3:lan"
290 ucidef_add_switch
"switch0" \
291 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
294 ucidef_add_switch
"switch0" \
295 "0@eth0" "1:lan" "2:lan" "3:wan"
298 teltonika
,rut955-h7v3c0
)
299 ucidef_set_interface_wan
"eth1"
300 ucidef_add_switch
"switch0" \
301 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
303 tplink
,archer-c5-v1|\
304 tplink
,archer-c7-v1|\
305 tplink
,archer-c7-v2|\
306 tplink
,tl-wdr4900-v2
)
307 ucidef_add_switch
"switch0" \
308 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
310 tplink
,archer-d50-v1
)
311 ucidef_add_switch
"switch0" \
312 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
314 tplink
,archer-d7-v1|\
315 tplink
,archer-d7b-v1
)
316 ucidef_add_switch
"switch0" \
317 "0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5"
319 tplink
,eap225-wall-v2
)
320 ucidef_add_switch
"switch0" \
321 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
324 ucidef_add_switch
"switch0" \
325 "0@eth0" "2:lan:1" "5:lan:2"
328 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "usb0"
329 ucidef_add_switch
"switch0" \
330 "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2"
332 tplink
,tl-wpa8630-v1|\
333 tplink
,tl-wpa8630p-v2-int|\
334 tplink
,tl-wpa8630p-v2.0
-eu|\
335 tplink
,tl-wpa8630p-v2.1
-eu)
336 # port 5 (internal) is the power-line port
337 ucidef_add_switch
"switch0" \
338 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
341 ucidef_set_interface_wan
"eth1"
342 ucidef_add_switch
"switch0" \
343 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
345 tplink
,tl-wr1043nd-v1
)
346 ucidef_add_switch
"switch0" \
347 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
349 tplink
,tl-wr1043nd-v2|\
350 tplink
,tl-wr1043nd-v3|\
351 tplink
,tl-wr1045nd-v2
)
352 ucidef_add_switch
"switch0" \
353 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
356 ucidef_add_switch
"switch0" \
357 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
360 ucidef_set_interface_wan
"eth1"
361 ucidef_add_switch
"switch0" \
362 "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
365 ucidef_set_interface_wan
"eth1"
366 ucidef_add_switch
"switch0" \
367 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
370 ucidef_set_interface_wan
"eth1"
371 ucidef_add_switch
"switch0" \
372 "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"
374 ubnt
,routerstation-pro
)
375 ucidef_set_interface_wan
"eth0"
376 ucidef_add_switch
"switch0" \
377 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
379 ubnt
,nanostation-m-xw
)
380 ucidef_add_switch
"switch0" \
381 "0@eth0" "5:lan" "1:wan"
383 ubnt
,unifiac-mesh-pro|\
385 ucidef_add_switch
"switch0" \
386 "0@eth0" "2:lan:1" "3:lan:2"
389 ucidef_add_switch
"switch0" \
390 "0@eth0" "1:lan" "2:lan"
394 ucidef_set_interface_wan
"eth1"
395 ucidef_add_switch
"switch0" \
396 "0@eth0" "3:lan:1" "4:lan:2"
399 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
411 lan_mac
=$
(mtd_get_mac_binary
"Board data" 2)
414 alfa-network
,ap121f|\
415 alfa-network
,ap121fe|\
418 engenius
,ens202ext-v1
)
419 label_mac
=$
(mtd_get_mac_binary art
0x1002)
422 base_mac
=$
(mtd_get_mac_binary art
0x1002)
423 lan_mac
=$
(macaddr_setbit
$base_mac 29)
424 [ $lan_mac = $base_mac ] && lan_mac
=$
(macaddr_unsetbit
$base_mac 29)
429 label_mac
=$
(fritz_tffs
-n macwlan
-i $
(find_mtd_part
"tffs (1)"))
432 lan_mac
=$
(fritz_tffs
-n maca
-i $
(find_mtd_part
"tffs (1)"))
433 label_mac
=$
(fritz_tffs
-n macwlan
-i $
(find_mtd_part
"tffs (1)"))
436 lan_mac
=$
(fritz_tffs
-n maca
-i $
(find_mtd_part
"tffs (1)"))
437 wan_mac
=$
(fritz_tffs
-n macb
-i $
(find_mtd_part
"tffs (1)"))
441 wan_mac
=$
(mtd_get_mac_binary u-boot
0x2e018)
444 label_mac
=$
(macaddr_add
"$(mtd_get_mac_binary art 0x1002)" 3)
449 lan_mac
=$
(mtd_get_mac_text
"mp" 0x1)
453 label_mac
=$
(mtd_get_mac_ascii bdcfg
"wlanmac")
456 lan_mac
=$
(mtd_get_mac_text
"caldata" 0xffa0)
457 wan_mac
=$
(mtd_get_mac_text
"caldata" 0xffb4)
460 lan_mac
=$
(mtd_get_mac_text
"mac" 0x4)
464 lan_mac
=$
(mtd_get_mac_text
"mac" 0x4)
465 wan_mac
=$
(mtd_get_mac_text
"mac" 0x18)
471 lan_mac
=$
(mtd_get_mac_ascii devdata
"lanmac")
472 wan_mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
478 lan_mac
=$
(mtd_get_mac_ascii devdata
"lanmac")
479 wan_mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
481 elecom
,wrc-1750ghbk2-i|\
482 elecom
,wrc-300ghbk2-i
)
483 wan_mac
=$
(macaddr_add
"$(mtd_get_mac_binary art 0x1002)" -2)
486 lan_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
487 label_mac
=$
(mtd_get_mac_ascii u-boot-env athaddr
)
491 ubnt
,bullet-m-ar7240|\
492 ubnt
,bullet-m-ar7241|\
494 ubnt
,nanostation-loco-m|\
500 label_mac
=$
(cat /sys
/class
/ieee80211
/phy
0/macaddress
)
503 lan_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
504 wan_mac
=$
(mtd_get_mac_ascii u-boot-env wanaddr
)
507 lan_mac
=$
(mtd_get_mac_text
"u-boot-env" 0xe9)
508 eth1_mac
=$
(macaddr_add
"$lan_mac" 1)
509 ucidef_set_interface
"eth0" ifname
"eth0" protocol
"none" macaddr
"$lan_mac"
510 ucidef_set_interface
"eth1" ifname
"eth1" protocol
"none" macaddr
"$eth1_mac"
512 enterasys
,ws-ap3705i
)
513 label_mac
=$
(mtd_get_mac_ascii u-boot-env0 ethaddr
)
516 hak5
,packet-squirrel
)
517 label_mac
=$
(mtd_get_mac_binary u-boot
0x1fc00)
520 lan_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
521 wan_mac
=$
(macaddr_add
"$lan_mac" -1)
524 iodata
,wn-ac1167dgr|\
525 iodata
,wn-ac1600dgr|\
526 iodata
,wn-ac1600dgr2|\
528 lan_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
529 wan_mac
=$
(mtd_get_mac_ascii u-boot-env wanaddr
)
533 wan_mac
=$
(fconfig
-s -r -d $
(find_mtd_part
"RedBoot config") -n alias
/ethaddr
)
534 lan_mac
=$
(macaddr_add
"$wan_mac" 1)
537 tplink
,tl-wdr3600-v1|\
538 tplink
,tl-wdr4300-v1|\
539 tplink
,tl-wdr4300-v1-il
)
540 base_mac
=$
(mtd_get_mac_binary u-boot
0x1fc00)
541 wan_mac
=$
(macaddr_add
"$base_mac" 1)
544 lan_mac
=$
(mtd_get_mac_text board_data
0x280)
545 wan_mac
=$
(mtd_get_mac_text board_data
0x480)
549 netgear
,wndr3700-v2|\
553 lan_mac
=$
(macaddr_setbit_la
"$(mtd_get_mac_binary art 0x0)")
556 lan_mac
=$
(k2t_get_mac
"lan_mac")
557 wan_mac
=$
(k2t_get_mac
"wan_mac")
560 wan_mac
=$
(mtd_get_mac_binary factory
0x0)
561 lan_mac
=$
(macaddr_setbit_la
"$wan_mac")
565 lan_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
566 wan_mac
=$
(mtd_get_mac_ascii u-boot-env wanaddr
)
569 tplink
,archer-a7-v5|\
570 tplink
,archer-c7-v4|\
571 tplink
,archer-c7-v5|\
572 tplink
,tl-wr1043nd-v4|\
573 tplink
,tl-wr1043n-v5
)
574 base_mac
=$
(mtd_get_mac_binary info
0x8)
575 wan_mac
=$
(macaddr_add
"$base_mac" 1)
578 lan_mac
=$
(mtd_get_mac_text mac
0x4)
579 wan_mac
=$
(mtd_get_mac_text mac
0x18)
582 ubnt
,litebeam-ac-gen2|\
583 ubnt
,powerbeam-5ac-500|\
584 ubnt
,powerbeam-5ac-gen2
)
585 label_mac
=$
(mtd_get_mac_binary art
0x5006)
588 ubnt
,routerstation-pro
)
589 wan_mac
=$
(fconfig
-s -r -d $
(find_mtd_part
"RedBoot config") -n ar7100_esa
)
590 lan_mac
=$
(macaddr_add
"$wan_mac" 1)
592 wd
,mynet-wifi-rangeextender
)
593 lan_mac
=$
(nvram get et0macaddr
)
596 label_mac
=$
(mtd_get_mac_ascii u-boot-env ethaddr
)
600 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr
"lan" $lan_mac
601 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr
"wan" $wan_mac
602 [ -n "$label_mac" ] && ucidef_set_label_macaddr
$label_mac
607 ath79_setup_interfaces
$board
608 ath79_setup_macs
$board