866d74fae435dfe5328f5b23ac06794c8d255ba5
[openwrt/openwrt.git] / target / linux / ath79 / generic / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions/system.sh
4 . /lib/functions/uci-defaults.sh
5 . /lib/functions/k2t.sh
6
7 ath79_setup_interfaces()
8 {
9 local board="$1"
10
11 case "$board" in
12 adtran,bsap1800-v2|\
13 adtran,bsap1840|\
14 allnet,all-wap02860ac|\
15 alfa-network,ap121f|\
16 alfa-network,pi-wifi4|\
17 arduino,yun|\
18 aruba,ap-105|\
19 avm,fritz1750e|\
20 avm,fritz300e|\
21 avm,fritzdvbc|\
22 comfast,cf-wr752ac-v1|\
23 comfast,cf-e130n-v2|\
24 devolo,dvl1200i|\
25 devolo,dvl1750c|\
26 devolo,dvl1750i|\
27 devolo,dvl1750x|\
28 dlink,dap-1330-a1|\
29 dlink,dap-1365-a1|\
30 dlink,dir-505|\
31 engenius,eap300-v2|\
32 engenius,ecb1750|\
33 enterasys,ws-ap3705i|\
34 glinet,gl-ar300m-lite|\
35 hak5,wifi-pineapple-nano|\
36 meraki,mr16|\
37 netgear,ex6400|\
38 netgear,ex7300|\
39 ocedo,koala|\
40 ocedo,raccoon|\
41 pcs,cap324|\
42 pisen,ts-d084|\
43 pisen,wmb001n|\
44 pisen,wmm003n|\
45 siemens,ws-ap3610|\
46 tplink,cpe210-v2|\
47 tplink,cpe210-v3|\
48 tplink,cpe510-v2|\
49 tplink,cpe510-v3|\
50 tplink,cpe610-v1|\
51 tplink,cpe610-v2|\
52 tplink,eap225-outdoor-v1|\
53 tplink,eap225-v3|\
54 tplink,eap245-v1|\
55 tplink,re350k-v1|\
56 tplink,re355-v1|\
57 tplink,re450-v1|\
58 tplink,re450-v2|\
59 tplink,re450-v3|\
60 tplink,tl-wr902ac-v1|\
61 ubnt,bullet-m-ar7240|\
62 ubnt,bullet-m-ar7241|\
63 ubnt,bullet-m-xw|\
64 ubnt,lap-120|\
65 ubnt,litebeam-ac-gen2|\
66 ubnt,nanobeam-ac|\
67 ubnt,nanobridge-m|\
68 ubnt,nanostation-ac-loco|\
69 ubnt,nanostation-loco-m|\
70 ubnt,nanostation-loco-m-xw|\
71 ubnt,picostation-m|\
72 ubnt,powerbeam-5ac-500|\
73 ubnt,powerbeam-5ac-gen2|\
74 ubnt,powerbridge-m|\
75 ubnt,rocket-m|\
76 ubnt,unifiac-lite|\
77 ubnt,unifiac-lr|\
78 ubnt,unifiac-mesh|\
79 ubnt,unifi|\
80 wd,mynet-wifi-rangeextender|\
81 winchannel,wb2000)
82 ucidef_set_interface_lan "eth0"
83 ;;
84 airtight,c-75)
85 ucidef_add_switch "switch0" \
86 "0@eth0" "2:wan" "3:lan" "6@eth1"
87 ;;
88 alfa-network,ap121fe)
89 ucidef_set_interface_lan "eth0 usb0"
90 ;;
91 alfa-network,n2q|\
92 alfa-network,n5q|\
93 devolo,dvl1200e|\
94 devolo,dvl1750e|\
95 ocedo,ursus)
96 ucidef_set_interface_lan "eth0 eth1"
97 ;;
98 avm,fritz4020|\
99 pcs,cr3000|\
100 tplink,archer-c58-v1|\
101 tplink,archer-c59-v1|\
102 tplink,archer-c59-v2)
103 ucidef_set_interface_wan "eth1"
104 ucidef_add_switch "switch0" \
105 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
106 ;;
107 belkin,f9j1108-v2|\
108 belkin,f9k1115-v2|\
109 tplink,archer-c5-v1|\
110 tplink,archer-c7-v1|\
111 tplink,archer-c7-v2|\
112 tplink,tl-wdr4900-v2|\
113 tplink,tl-wdr7500-v3)
114 ucidef_add_switch "switch0" \
115 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
116 ;;
117 buffalo,bhr-4grv|\
118 buffalo,wzr-hp-g450h)
119 ucidef_add_switch "switch0" \
120 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
121 ;;
122 buffalo,bhr-4grv2|\
123 trendnet,tew-823dru)
124 ucidef_add_switch "switch0" \
125 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
126 ;;
127 buffalo,wzr-600dhp|\
128 buffalo,wzr-hp-ag300h|\
129 tplink,archer-c25-v1|\
130 tplink,archer-c60-v1|\
131 tplink,archer-c60-v2|\
132 tplink,archer-c60-v3|\
133 tplink,tl-wdr3500-v1|\
134 tplink,tl-wr842n-v1|\
135 tplink,tl-wr842n-v3|\
136 ubnt,airrouter)
137 ucidef_set_interface_wan "eth1"
138 ucidef_add_switch "switch0" \
139 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
140 ;;
141 buffalo,wzr-hp-g302h-a1a0)
142 ucidef_add_switch "switch0" \
143 "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
144 ;;
145 comfast,cf-e110n-v2|\
146 comfast,cf-e120a-v3|\
147 comfast,cf-e314n-v2|\
148 compex,wpj531-16m|\
149 tplink,cpe210-v1|\
150 tplink,cpe220-v2|\
151 tplink,cpe220-v3|\
152 tplink,cpe510-v1|\
153 tplink,wbs210-v1|\
154 tplink,wbs210-v2|\
155 tplink,wbs510-v1|\
156 tplink,wbs510-v2|\
157 ubnt,nanostation-m|\
158 ubnt,routerstation)
159 ucidef_set_interfaces_lan_wan "eth1" "eth0"
160 ;;
161 comfast,cf-e560ac)
162 ucidef_set_interface_wan "eth1"
163 ucidef_add_switch "switch0" \
164 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
165 ;;
166 comfast,cf-wr650ac-v1|\
167 comfast,cf-wr650ac-v2|\
168 zyxel,nbg6616)
169 ucidef_add_switch "switch0" \
170 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
171 ;;
172 compex,wpj344-16m|\
173 compex,wpj563)
174 ucidef_add_switch "switch0" \
175 "0@eth0" "3:lan" "2:wan"
176 ;;
177 devolo,magic-2-wifi)
178 ucidef_add_switch "switch0" \
179 "0@eth0" "2:wan" "3:lan" "4:lan"
180 ;;
181 dlink,dap-2695-a1)
182 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
183 ;;
184 dlink,dch-g020-a1)
185 ucidef_add_switch "switch0" \
186 "0@eth0" "1:lan:2" "2:lan:1"
187 ;;
188 dlink,dir-825-b1)
189 ucidef_set_interface_wan "eth1"
190 ucidef_add_switch "switch0" \
191 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
192 ;;
193 dlink,dir-825-c1|\
194 dlink,dir-835-a1|\
195 dlink,dir-842-c1|\
196 dlink,dir-842-c2|\
197 dlink,dir-842-c3|\
198 dlink,dir-859-a1|\
199 engenius,epg5000|\
200 tplink,archer-c2-v3|\
201 tplink,tl-wr1043nd-v4|\
202 tplink,tl-wr1043n-v5)
203 ucidef_add_switch "switch0" \
204 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
205 ;;
206 elecom,wrc-1750ghbk2-i|\
207 elecom,wrc-300ghbk2-i|\
208 sitecom,wlr-8100)
209 ucidef_add_switch "switch0" \
210 "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
211 ;;
212 embeddedwireless,dorin)
213 ucidef_add_switch "switch0" \
214 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
215 ;;
216 engenius,enh202-v1)
217 ucidef_set_interface_wan "eth0"
218 ucidef_add_switch "switch0" \
219 "0@eth1" "4:lan:1"
220 ;;
221 engenius,ens202ext-v1)
222 ucidef_set_interface_wan "eth1"
223 ucidef_add_switch "switch0" \
224 "0@eth0" "1:lan"
225 ;;
226 engenius,ews511ap)
227 ucidef_set_interface_lan "eth0 eth1" "dhcp"
228 ;;
229 etactica,eg200)
230 ucidef_set_interface_lan "eth0" "dhcp"
231 ;;
232 glinet,gl-ar750)
233 ucidef_set_interface_wan "eth1"
234 ucidef_add_switch "switch0" \
235 "0@eth0" "1:lan" "2:lan"
236 ;;
237 iodata,etg3-r|\
238 iodata,wn-ac1167dgr|\
239 iodata,wn-ac1600dgr|\
240 iodata,wn-ac1600dgr2|\
241 iodata,wn-ag300dgr|\
242 pcs,cr5000|\
243 sitecom,wlr-7100|\
244 wd,mynet-n750)
245 ucidef_add_switch "switch0" \
246 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
247 ;;
248 librerouter,librerouter-v1)
249 ucidef_add_switch "switch0" \
250 "0@eth0" "5:wan" "6@eth1" "4:lan"
251 ;;
252 mercury,mw4530r-v1|\
253 tplink,archer-a7-v5|\
254 tplink,archer-c6-v2|\
255 tplink,archer-c6-v2-us|\
256 tplink,archer-c7-v4|\
257 tplink,archer-c7-v5|\
258 tplink,tl-wdr3600-v1|\
259 tplink,tl-wdr4300-v1|\
260 tplink,tl-wdr4300-v1-il|\
261 tplink,tl-wdr4310-v1)
262 ucidef_add_switch "switch0" \
263 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
264 ;;
265 nec,wg1200cr|\
266 qxwlan,e1700ac-v2-8m|\
267 qxwlan,e1700ac-v2-16m|\
268 qxwlan,e750g-v8-8m|\
269 qxwlan,e750g-v8-16m|\
270 ubnt,nanobeam-ac-gen2|\
271 ubnt,nanostation-ac|\
272 yuncore,a782|\
273 yuncore,xd4200)
274 ucidef_add_switch "switch0" \
275 "0@eth0" "2:lan" "3:wan"
276 ;;
277 nec,wg800hp)
278 ucidef_add_switch "switch0" \
279 "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
280 ;;
281 netgear,wndr3700|\
282 netgear,wndr3700-v2|\
283 netgear,wndr3800|\
284 netgear,wndr3800ch|\
285 netgear,wndrmac-v1|\
286 netgear,wndrmac-v2)
287 ucidef_set_interface_wan "eth1"
288 ucidef_add_switch "switch0" \
289 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
290 ucidef_add_switch_attr "switch0" "blinkrate" 2
291 ucidef_add_switch_port_attr "switch0" 1 led 6
292 ucidef_add_switch_port_attr "switch0" 2 led 9
293 ucidef_add_switch_port_attr "switch0" 5 led 2
294 ;;
295 netgear,wnr2200-8m|\
296 netgear,wnr2200-16m)
297 ucidef_set_interface_wan "eth0"
298 ucidef_add_switch "switch0" \
299 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
300 ;;
301 phicomm,k2t)
302 ucidef_add_switch "switch0" \
303 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
304 ;;
305 qihoo,c301)
306 ucidef_set_interface_wan "eth1"
307 ucidef_add_switch "switch0" \
308 "0@eth0" "2:lan" "3:lan"
309 ;;
310 qxwlan,e558-v2-8m|\
311 qxwlan,e558-v2-16m)
312 ucidef_add_switch "switch0" \
313 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
314 ;;
315 rosinson,wr818)
316 ucidef_add_switch "switch0" \
317 "0@eth0" "1:lan" "2:lan" "3:wan"
318 ;;
319 teltonika,rut955|\
320 teltonika,rut955-h7v3c0)
321 ucidef_set_interface_wan "eth1"
322 ucidef_add_switch "switch0" \
323 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
324 ;;
325 tplink,archer-d50-v1)
326 ucidef_add_switch "switch0" \
327 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
328 ;;
329 tplink,archer-d7-v1|\
330 tplink,archer-d7b-v1)
331 ucidef_add_switch "switch0" \
332 "0@eth1" "3:lan:3" "4:lan:2" "5:lan:1" "6@eth0" "2:wan:4" "1:wan:5"
333 ;;
334 tplink,eap225-wall-v2)
335 ucidef_add_switch "switch0" \
336 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
337 ;;
338 tplink,eap245-v3)
339 ucidef_add_switch "switch0" \
340 "0@eth0" "2:lan:1" "5:lan:2"
341 ;;
342 tplink,tl-mr6400-v1)
343 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0"
344 ucidef_add_switch "switch0" \
345 "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2"
346 ;;
347 tplink,tl-wpa8630-v1|\
348 tplink,tl-wpa8630p-v2-int|\
349 tplink,tl-wpa8630p-v2.0-eu|\
350 tplink,tl-wpa8630p-v2.1-eu)
351 # port 5 (internal) is the power-line port
352 ucidef_add_switch "switch0" \
353 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
354 ;;
355 tplink,tl-wr842n-v2)
356 ucidef_set_interface_wan "eth1"
357 ucidef_add_switch "switch0" \
358 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
359 ;;
360 tplink,tl-wr1043nd-v1)
361 ucidef_add_switch "switch0" \
362 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
363 ;;
364 tplink,tl-wr1043nd-v2|\
365 tplink,tl-wr1043nd-v3|\
366 tplink,tl-wr1045nd-v2)
367 ucidef_add_switch "switch0" \
368 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
369 ;;
370 tplink,tl-wr2543-v1)
371 ucidef_add_switch "switch0" \
372 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
373 ;;
374 ubnt,aircube-isp)
375 ucidef_set_interface_wan "eth1"
376 ucidef_add_switch "switch0" \
377 "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
378 ;;
379 ubnt,edgeswitch-5xp)
380 ucidef_set_interface_wan "eth1"
381 ucidef_add_switch "switch0" \
382 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
383 ;;
384 ubnt,edgeswitch-8xp)
385 ucidef_set_interface_wan "eth1"
386 ucidef_add_switch "switch0" \
387 "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"
388 ;;
389 ubnt,routerstation-pro)
390 ucidef_set_interface_wan "eth0"
391 ucidef_add_switch "switch0" \
392 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
393 ;;
394 ubnt,nanostation-m-xw)
395 ucidef_add_switch "switch0" \
396 "0@eth0" "5:lan" "1:wan"
397 ;;
398 ubnt,unifiac-mesh-pro|\
399 ubnt,unifiac-pro)
400 ucidef_add_switch "switch0" \
401 "0@eth0" "2:lan:1" "3:lan:2"
402 ;;
403 ubnt,unifi-ap-pro)
404 ucidef_add_switch "switch0" \
405 "0@eth0" "1:lan" "2:lan"
406 ;;
407 zbtlink,zbt-wd323|\
408 xiaomi,mi-router-4q)
409 ucidef_set_interface_wan "eth1"
410 ucidef_add_switch "switch0" \
411 "0@eth0" "3:lan:1" "4:lan:2"
412 ;;
413 *)
414 ucidef_set_interfaces_lan_wan "eth0" "eth1"
415 ;;
416 esac
417 }
418
419 ath79_setup_macs()
420 {
421 local board="$1"
422
423 case "$board" in
424 adtran,bsap1800-v2|\
425 adtran,bsap1840)
426 lan_mac=$(mtd_get_mac_binary "Board data" 2)
427 label_mac=$lan_mac
428 ;;
429 alfa-network,ap121f|\
430 alfa-network,ap121fe|\
431 alfa-network,n2q|\
432 alfa-network,n5q|\
433 alfa-network,pi-wifi4|\
434 alfa-network,r36a|\
435 engenius,eap300-v2|\
436 engenius,ens202ext-v1)
437 label_mac=$(mtd_get_mac_binary art 0x1002)
438 ;;
439 arduino,yun)
440 base_mac=$(mtd_get_mac_binary art 0x1002)
441 lan_mac=$(macaddr_setbit $base_mac 29)
442 [ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
443 ;;
444 avm,fritz1750e|\
445 avm,fritz450e|\
446 avm,fritzdvbc)
447 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
448 ;;
449 avm,fritz300e)
450 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
451 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
452 ;;
453 avm,fritz4020)
454 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
455 wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)"))
456 ;;
457 compex,wpj344-16m|\
458 compex,wpj563)
459 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
460 ;;
461 devolo,magic-2-wifi)
462 label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3)
463 ;;
464 dlink,dap-1330-a1|\
465 dlink,dap-1365-a1|\
466 dlink,dch-g020-a1)
467 lan_mac=$(mtd_get_mac_text "mp" 0x1)
468 label_mac=$lan_mac
469 ;;
470 dlink,dap-2695-a1)
471 label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
472 ;;
473 dlink,dir-825-b1)
474 lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
475 wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
476 ;;
477 dlink,dir-505)
478 lan_mac=$(mtd_get_mac_text "mac" 0x4)
479 ;;
480 dlink,dir-825-c1|\
481 dlink,dir-835-a1)
482 lan_mac=$(mtd_get_mac_text "mac" 0x4)
483 wan_mac=$(mtd_get_mac_text "mac" 0x18)
484 ;;
485 dlink,dir-842-c1|\
486 dlink,dir-842-c2|\
487 dlink,dir-842-c3|\
488 nec,wg1200cr)
489 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
490 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
491 label_mac=$lan_mac
492 ;;
493 dlink,dir-859-a1|\
494 qihoo,c301|\
495 wd,mynet-n750)
496 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
497 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
498 ;;
499 elecom,wrc-1750ghbk2-i|\
500 elecom,wrc-300ghbk2-i)
501 wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2)
502 ;;
503 engenius,ecb1750)
504 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
505 label_mac=$(mtd_get_mac_ascii u-boot-env athaddr)
506 ;;
507 engenius,enh202-v1|\
508 ubnt,airrouter|\
509 ubnt,bullet-m-ar7240|\
510 ubnt,bullet-m-ar7241|\
511 ubnt,nanobridge-m|\
512 ubnt,nanostation-loco-m|\
513 ubnt,nanostation-m|\
514 ubnt,picostation-m|\
515 ubnt,powerbridge-m|\
516 ubnt,rocket-m|\
517 ubnt,unifi)
518 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
519 ;;
520 engenius,epg5000)
521 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
522 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
523 ;;
524 engenius,ews511ap)
525 lan_mac=$(mtd_get_mac_text "u-boot-env" 0xe9)
526 eth1_mac=$(macaddr_add "$lan_mac" 1)
527 ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac"
528 ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac"
529 ;;
530 enterasys,ws-ap3705i)
531 label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr)
532 ;;
533 hak5,lan-turtle|\
534 hak5,packet-squirrel)
535 label_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
536 ;;
537 iodata,etg3-r)
538 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
539 wan_mac=$(macaddr_add "$lan_mac" -1)
540 label_mac=$wan_mac
541 ;;
542 iodata,wn-ac1167dgr|\
543 iodata,wn-ac1600dgr|\
544 iodata,wn-ac1600dgr2|\
545 iodata,wn-ag300dgr)
546 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
547 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
548 label_mac=$wan_mac
549 ;;
550 jjplus,ja76pf2)
551 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
552 lan_mac=$(macaddr_add "$wan_mac" 1)
553 ;;
554 mercury,mw4530r-v1|\
555 tplink,tl-wdr3600-v1|\
556 tplink,tl-wdr4300-v1|\
557 tplink,tl-wdr4300-v1-il)
558 base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
559 wan_mac=$(macaddr_add "$base_mac" 1)
560 ;;
561 nec,wg800hp)
562 lan_mac=$(mtd_get_mac_text board_data 0x280)
563 wan_mac=$(mtd_get_mac_text board_data 0x480)
564 label_mac=$wan_mac
565 ;;
566 netgear,wndr3700|\
567 netgear,wndr3700-v2|\
568 netgear,wndr3800|\
569 netgear,wndrmac-v1|\
570 netgear,wndrmac-v2)
571 lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)")
572 ;;
573 phicomm,k2t)
574 lan_mac=$(k2t_get_mac "lan_mac")
575 wan_mac=$(k2t_get_mac "wan_mac")
576 ;;
577 rosinson,wr818)
578 wan_mac=$(mtd_get_mac_binary factory 0x0)
579 lan_mac=$(macaddr_setbit_la "$wan_mac")
580 ;;
581 sitecom,wlr-7100|\
582 sitecom,wlr-8100)
583 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
584 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
585 label_mac=$lan_mac
586 ;;
587 tplink,archer-a7-v5|\
588 tplink,archer-c7-v4|\
589 tplink,archer-c7-v5|\
590 tplink,tl-wr1043nd-v4|\
591 tplink,tl-wr1043n-v5)
592 base_mac=$(mtd_get_mac_binary info 0x8)
593 wan_mac=$(macaddr_add "$base_mac" 1)
594 ;;
595 trendnet,tew-823dru)
596 lan_mac=$(mtd_get_mac_text mac 0x4)
597 wan_mac=$(mtd_get_mac_text mac 0x18)
598 label_mac=$wan_mac
599 ;;
600 ubnt,litebeam-ac-gen2|\
601 ubnt,nanobeam-ac-gen2|\
602 ubnt,powerbeam-5ac-500|\
603 ubnt,powerbeam-5ac-gen2)
604 label_mac=$(mtd_get_mac_binary art 0x5006)
605 ;;
606 ubnt,routerstation|\
607 ubnt,routerstation-pro)
608 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
609 lan_mac=$(macaddr_add "$wan_mac" 1)
610 ;;
611 wd,mynet-wifi-rangeextender)
612 lan_mac=$(nvram get et0macaddr)
613 ;;
614 zyxel,nbg6616)
615 label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
616 ;;
617 esac
618
619 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
620 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
621 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
622 }
623
624 board_config_update
625 board=$(board_name)
626 ath79_setup_interfaces $board
627 ath79_setup_macs $board
628 board_config_flush
629
630 exit 0