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