bc32081910f86b73dea07f5d857e7601f52dd0a2
[openwrt/openwrt.git] / target / linux / ath79 / generic / base-files / etc / board.d / 02_network
1
2 . /lib/functions/system.sh
3 . /lib/functions/uci-defaults.sh
4 . /lib/functions/k2t.sh
5
6 ath79_setup_interfaces()
7 {
8 local board="$1"
9
10 case "$board" in
11 adtran,bsap1800-v2|\
12 adtran,bsap1840|\
13 allnet,all-wap02860ac|\
14 alfa-network,ap121f|\
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|\
20 arduino,yun|\
21 aruba,ap-105|\
22 asus,rp-ac66|\
23 avm,fritz1750e|\
24 avm,fritz300e|\
25 avm,fritzdvbc|\
26 comfast,cf-wr752ac-v1|\
27 comfast,cf-e130n-v2|\
28 devolo,dvl1200i|\
29 devolo,dvl1750c|\
30 devolo,dvl1750i|\
31 devolo,dvl1750x|\
32 dlink,dap-1330-a1|\
33 dlink,dap-1365-a1|\
34 dlink,dap-2230-a1|\
35 dlink,dap-2660-a1|\
36 dlink,dap-2680-a1|\
37 dlink,dap-3320-a1|\
38 dlink,dir-505|\
39 engenius,eap1200h|\
40 engenius,eap600|\
41 engenius,ecb1200|\
42 engenius,ecb1750|\
43 engenius,ecb600|\
44 enterasys,ws-ap3705i|\
45 glinet,gl-ar300m-lite|\
46 glinet,gl-usb150|\
47 hak5,wifi-pineapple-nano|\
48 meraki,mr16|\
49 netgear,ex6400|\
50 netgear,ex7300|\
51 netgear,ex7300-v2|\
52 ocedo,koala|\
53 ocedo,raccoon|\
54 onion,omega|\
55 openmesh,mr600-v1|\
56 openmesh,mr600-v2|\
57 openmesh,mr900-v1|\
58 openmesh,mr900-v2|\
59 openmesh,mr1750-v1|\
60 openmesh,mr1750-v2|\
61 pcs,cap324|\
62 pisen,ts-d084|\
63 pisen,wmb001n|\
64 pisen,wmm003n|\
65 siemens,ws-ap3610|\
66 tplink,cpe210-v2|\
67 tplink,cpe210-v3|\
68 tplink,cpe510-v2|\
69 tplink,cpe510-v3|\
70 tplink,cpe610-v1|\
71 tplink,cpe610-v2|\
72 tplink,cpe710-v1|\
73 tplink,eap225-outdoor-v1|\
74 tplink,eap225-v1|\
75 tplink,eap225-v3|\
76 tplink,eap245-v1|\
77 tplink,re350k-v1|\
78 tplink,re355-v1|\
79 tplink,re450-v1|\
80 tplink,re450-v2|\
81 tplink,re450-v3|\
82 tplink,re455-v1|\
83 tplink,tl-wa1201-v2|\
84 tplink,tl-wr902ac-v1|\
85 ubnt,bullet-ac|\
86 ubnt,bullet-m-ar7240|\
87 ubnt,bullet-m-ar7241|\
88 ubnt,bullet-m-xw|\
89 ubnt,lap-120|\
90 ubnt,litebeam-ac-gen2|\
91 ubnt,nanobeam-ac|\
92 ubnt,nanobeam-ac-xc|\
93 ubnt,nanobridge-m|\
94 ubnt,nanostation-ac-loco|\
95 ubnt,nanostation-loco-m|\
96 ubnt,nanostation-loco-m-xw|\
97 ubnt,picostation-m|\
98 ubnt,powerbeam-5ac-500|\
99 ubnt,powerbeam-5ac-gen2|\
100 ubnt,powerbeam-m2-xw|\
101 ubnt,powerbeam-m5-xw|\
102 ubnt,powerbridge-m|\
103 ubnt,rocket-5ac-lite|\
104 ubnt,rocket-m|\
105 ubnt,unifiac-lite|\
106 ubnt,unifiac-lr|\
107 ubnt,unifiac-mesh|\
108 ubnt,unifi|\
109 wd,mynet-wifi-rangeextender|\
110 winchannel,wb2000)
111 ucidef_set_interface_lan "eth0"
112 ;;
113 airtight,c-75)
114 ucidef_add_switch "switch0" \
115 "0@eth0" "2:wan" "3:lan" "6@eth1"
116 ;;
117 alfa-network,ap121fe)
118 ucidef_set_interface_lan "eth0 usb0"
119 ;;
120 alfa-network,n2q|\
121 alfa-network,n5q|\
122 devolo,dvl1200e|\
123 devolo,dvl1750e|\
124 engenius,enstationac-v1|\
125 engenius,ews511ap|\
126 ocedo,ursus|\
127 ubnt,unifi-ap-outdoor-plus)
128 ucidef_set_interface_lan "eth0 eth1"
129 ;;
130 atheros,db120)
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"
135 ;;
136 avm,fritz4020|\
137 pcs,cr3000|\
138 tplink,archer-c58-v1|\
139 tplink,archer-c59-v1|\
140 tplink,archer-c59-v2|\
141 wd,mynet-n600)
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"
145 ;;
146 belkin,f9j1108-v2|\
147 belkin,f9k1115-v2|\
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"
155 ;;
156 buffalo,bhr-4grv|\
157 buffalo,wzr-hp-g450h)
158 ucidef_add_switch "switch0" \
159 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
160 ;;
161 buffalo,bhr-4grv2|\
162 trendnet,tew-823dru)
163 ucidef_add_switch "switch0" \
164 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
165 ;;
166 buffalo,wzr-600dhp|\
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|\
175 ubnt,airrouter)
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"
179 ;;
180 buffalo,wzr-hp-g300nh-rb|\
181 buffalo,wzr-hp-g300nh-s|\
182 dlink,dir-825-b1)
183 ucidef_set_interface_wan "eth1"
184 ucidef_add_switch "switch0" \
185 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
186 ;;
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"
190 ;;
191 comfast,cf-e110n-v2|\
192 comfast,cf-e120a-v3|\
193 comfast,cf-e314n-v2|\
194 compex,wpj531-16m|\
195 openmesh,a40|\
196 openmesh,a60|\
197 openmesh,om2p-v1|\
198 openmesh,om2p-v4|\
199 openmesh,om2p-hs-v4|\
200 plasmacloud,pa300|\
201 plasmacloud,pa300e|\
202 tplink,cpe210-v1|\
203 tplink,cpe220-v2|\
204 tplink,cpe220-v3|\
205 tplink,cpe510-v1|\
206 tplink,wbs210-v1|\
207 tplink,wbs210-v2|\
208 tplink,wbs510-v1|\
209 tplink,wbs510-v2|\
210 ubnt,nanostation-m|\
211 ubnt,routerstation)
212 ucidef_set_interfaces_lan_wan "eth1" "eth0"
213 ;;
214 comfast,cf-e375ac)
215 ucidef_add_switch "switch0" \
216 "0@eth0" "1:wan" "2:lan"
217 ;;
218 comfast,cf-e560ac|\
219 qca,ap143-8m|\
220 qca,ap143-16m|\
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"
225 ;;
226 comfast,cf-wr650ac-v1|\
227 comfast,cf-wr650ac-v2|\
228 zyxel,nbg6616)
229 ucidef_add_switch "switch0" \
230 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
231 ;;
232 compex,wpj344-16m|\
233 compex,wpj563)
234 ucidef_add_switch "switch0" \
235 "0@eth0" "3:lan" "2:wan"
236 ;;
237 compex,wpj558-16m)
238 ucidef_add_switch "switch0" \
239 "1:wan" "5:lan" "6@eth0"
240 ;;
241 devolo,dlan-pro-1200plus-ac|\
242 devolo,magic-2-wifi)
243 ucidef_add_switch "switch0" \
244 "0@eth0" "2:wan" "3:lan" "4:lan"
245 ;;
246 dlink,dap-2695-a1)
247 ucidef_add_switch "switch0" \
248 "0@eth0" "2:lan" "3:wan" "6@eth1"
249 ;;
250 dlink,dap-3662-a1)
251 ucidef_add_switch "switch0" \
252 "0@eth0" "1:lan:2" "2:lan:1" "6@eth1"
253 ;;
254 dlink,dch-g020-a1)
255 ucidef_add_switch "switch0" \
256 "0@eth0" "1:lan:2" "2:lan:1"
257 ;;
258 dlink,dir-825-c1|\
259 dlink,dir-835-a1|\
260 dlink,dir-842-c1|\
261 dlink,dir-842-c2|\
262 dlink,dir-842-c3|\
263 dlink,dir-859-a1|\
264 engenius,epg5000|\
265 sitecom,wlr-7100|\
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"
271 ;;
272 elecom,wrc-1750ghbk2-i|\
273 elecom,wrc-300ghbk2-i|\
274 sitecom,wlr-8100)
275 ucidef_add_switch "switch0" \
276 "0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
277 ;;
278 embeddedwireless,balin)
279 ucidef_add_switch "switch0" \
280 "0@eth0" "5:lan:1" "4:lan:2" "3:wan"
281 ;;
282 embeddedwireless,dorin)
283 ucidef_add_switch "switch0" \
284 "0@eth0" "1:wan" "2:lan:3" "3:lan:2"
285 ;;
286 engenius,eap300-v2)
287 ucidef_add_switch "switch0" \
288 "0@eth0" "1:lan"
289 ;;
290 engenius,ens202ext-v1)
291 ucidef_set_interface_lan "eth1"
292 ucidef_add_switch "switch0" \
293 "0@eth0" "1:lan"
294 ;;
295 etactica,eg200)
296 ucidef_set_interface_lan "eth0" "dhcp"
297 ;;
298 glinet,gl-ar750)
299 ucidef_set_interface_wan "eth1"
300 ucidef_add_switch "switch0" \
301 "0@eth0" "1:lan" "2:lan"
302 ;;
303 glinet,gl-x300b)
304 ucidef_set_interface_wan "eth1"
305 ucidef_add_switch "switch0" \
306 "0@eth0" "4:lan"
307 ;;
308 iodata,etg3-r|\
309 iodata,wn-ac1167dgr|\
310 iodata,wn-ac1600dgr|\
311 iodata,wn-ac1600dgr2|\
312 iodata,wn-ag300dgr|\
313 pcs,cr5000|\
314 wd,mynet-n750)
315 ucidef_add_switch "switch0" \
316 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
317 ;;
318 jjplus,jwap230)
319 ucidef_add_switch "switch0" \
320 "0@eth0" "5:wan:1" "1:lan:2" "6@eth1"
321 ;;
322 joyit,jt-or750i)
323 ucidef_set_interface_wan "eth1"
324 ucidef_add_switch "switch0" \
325 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
326 ;;
327 letv,lba-047-ch)
328 ucidef_set_interface_wan "eth0"
329 ucidef_add_switch "switch0" \
330 "0@eth1" "3:lan:2" "4:lan:1"
331 ;;
332 librerouter,librerouter-v1)
333 ucidef_add_switch "switch0" \
334 "0@eth0" "5:wan" "6@eth1" "4:lan"
335 ;;
336 meraki,mr12)
337 ucidef_set_interface_lan "eth0"
338 ucidef_add_switch "switch0" \
339 "0@eth1" "1:lan"
340 ;;
341 mercury,mw4530r-v1|\
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"
354 ;;
355 nec,wf1200cr)
356 ucidef_set_interface_wan "eth1"
357 ucidef_add_switch "switch0" \
358 "0@eth0" "1:lan"
359 ;;
360 nec,wg1200cr|\
361 qxwlan,e1700ac-v2-8m|\
362 qxwlan,e1700ac-v2-16m|\
363 qxwlan,e750g-v8-8m|\
364 qxwlan,e750g-v8-16m|\
365 ubnt,nanobeam-ac-gen2|\
366 ubnt,nanostation-ac|\
367 yuncore,a782|\
368 yuncore,xd4200)
369 ucidef_add_switch "switch0" \
370 "0@eth0" "2:lan" "3:wan"
371 ;;
372 nec,wg800hp|\
373 xiaomi,aiot-ac2350)
374 ucidef_add_switch "switch0" \
375 "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
376 ;;
377 netgear,wndr3700|\
378 netgear,wndr3700-v2|\
379 netgear,wndr3800|\
380 netgear,wndr3800ch|\
381 netgear,wndrmac-v1|\
382 netgear,wndrmac-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
390 ;;
391 netgear,wnr2200-8m|\
392 netgear,wnr2200-16m)
393 ucidef_set_interface_wan "eth0"
394 ucidef_add_switch "switch0" \
395 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
396 ;;
397 phicomm,k2t)
398 ucidef_add_switch "switch0" \
399 "0@eth0" "3:lan:1" "5:lan:2" "4:wan"
400 ;;
401 qihoo,c301)
402 ucidef_set_interface_wan "eth1"
403 ucidef_add_switch "switch0" \
404 "0@eth0" "2:lan" "3:lan"
405 ;;
406 qxwlan,e558-v2-8m|\
407 qxwlan,e558-v2-16m)
408 ucidef_add_switch "switch0" \
409 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
410 ;;
411 rosinson,wr818)
412 ucidef_add_switch "switch0" \
413 "0@eth0" "1:lan" "2:lan" "3:wan"
414 ;;
415 teltonika,rut955|\
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"
420 ;;
421 tplink,archer-d50-v1)
422 ucidef_add_switch "switch0" \
423 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
424 ;;
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"
429 ;;
430 tplink,eap225-wall-v2)
431 ucidef_add_switch "switch0" \
432 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
433 ;;
434 tplink,eap245-v3)
435 ucidef_add_switch "switch0" \
436 "0@eth0" "2:lan:1" "5:lan:2"
437 ;;
438 tplink,tl-mr6400-v1)
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"
442 ;;
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"
450 ;;
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"
457 ;;
458 tplink,tl-wr1043nd-v1)
459 ucidef_add_switch "switch0" \
460 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
461 ;;
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"
467 ;;
468 tplink,tl-wr2543-v1)
469 ucidef_add_switch "switch0" \
470 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
471 ;;
472 ubnt,aircube-ac)
473 ucidef_add_switch "switch0" \
474 "0@eth0" "2:lan:1" "3:lan:2" "5:lan:3" "4:wan"
475 ;;
476 ubnt,aircube-isp)
477 ucidef_set_interface_wan "eth1"
478 ucidef_add_switch "switch0" \
479 "0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
480 ;;
481 ubnt,edgeswitch-5xp)
482 ucidef_set_interface_wan "eth1"
483 ucidef_add_switch "switch0" \
484 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
485 ;;
486 ubnt,edgeswitch-8xp)
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"
490 ;;
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"
495 ;;
496 ubnt,nanostation-m-xw)
497 ucidef_add_switch "switch0" \
498 "0@eth0" "5:lan" "1:wan"
499 ;;
500 ubnt,unifiac-mesh-pro|\
501 ubnt,unifiac-pro)
502 ucidef_add_switch "switch0" \
503 "0@eth0" "2:lan:1" "3:lan:2"
504 ;;
505 ubnt,unifi-ap-pro)
506 ucidef_add_switch "switch0" \
507 "0@eth0" "1:lan" "2:lan"
508 ;;
509 xiaomi,mi-router-4q|\
510 zbtlink,zbt-wd323)
511 ucidef_set_interface_wan "eth1"
512 ucidef_add_switch "switch0" \
513 "0@eth0" "3:lan:1" "4:lan:2"
514 ;;
515 *)
516 ucidef_set_interfaces_lan_wan "eth0" "eth1"
517 ;;
518 esac
519 }
520
521 ath79_setup_macs()
522 {
523 local board="$1"
524
525 case "$board" in
526 adtran,bsap1800-v2|\
527 adtran,bsap1840)
528 lan_mac=$(mtd_get_mac_binary "Board data" 2)
529 label_mac=$lan_mac
530 ;;
531 alfa-network,ap121f|\
532 alfa-network,ap121fe|\
533 alfa-network,n2q|\
534 alfa-network,n5q|\
535 alfa-network,pi-wifi4|\
536 alfa-network,r36a|\
537 alfa-network,tube-2hq|\
538 engenius,eap300-v2|\
539 engenius,ens202ext-v1)
540 label_mac=$(mtd_get_mac_binary art 0x1002)
541 ;;
542 arduino,yun)
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)
546 ;;
547 avm,fritz1750e|\
548 avm,fritz450e|\
549 avm,fritzdvbc)
550 label_mac=$(fritz_tffs -n macwlan -i $(find_mtd_part "tffs (1)"))
551 ;;
552 avm,fritz300e)
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)"))
555 ;;
556 avm,fritz4020)
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)"))
559 ;;
560 comfast,cf-e375ac)
561 wan_mac=$(macaddr_add $(mtd_get_mac_binary art 0x0) 1)
562 ;;
563 compex,wpj344-16m|\
564 compex,wpj558-16m|\
565 compex,wpj563)
566 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
567 ;;
568 devolo,dlan-pro-1200plus-ac|\
569 devolo,magic-2-wifi)
570 label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3)
571 ;;
572 dlink,dap-1330-a1|\
573 dlink,dap-1365-a1|\
574 dlink,dch-g020-a1)
575 lan_mac=$(mtd_get_mac_text "mp" 0x1)
576 label_mac=$lan_mac
577 ;;
578 dlink,dap-2230-a1|\
579 dlink,dap-2660-a1|\
580 dlink,dap-2680-a1|\
581 dlink,dap-3320-a1)
582 lan_mac=$(mtd_get_mac_ascii bdcfg "lanmac")
583 label_mac=$lan_mac
584 ;;
585 dlink,dap-2695-a1|\
586 dlink,dap-3662-a1)
587 label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
588 ;;
589 dlink,dir-825-b1)
590 lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
591 wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
592 ;;
593 dlink,dir-505)
594 lan_mac=$(mtd_get_mac_text "mac" 0x4)
595 ;;
596 dlink,dir-825-c1|\
597 dlink,dir-835-a1)
598 lan_mac=$(mtd_get_mac_text "mac" 0x4)
599 wan_mac=$(mtd_get_mac_text "mac" 0x18)
600 ;;
601 dlink,dir-842-c1|\
602 dlink,dir-842-c2|\
603 dlink,dir-842-c3)
604 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
605 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
606 label_mac=$lan_mac
607 ;;
608 dlink,dir-859-a1|\
609 qihoo,c301|\
610 wd,mynet-n600|\
611 wd,mynet-n750)
612 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
613 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
614 ;;
615 elecom,wrc-1750ghbk2-i|\
616 elecom,wrc-300ghbk2-i)
617 wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2)
618 ;;
619 engenius,ecb1200|\
620 engenius,ecb1750)
621 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
622 label_mac=$lan_mac
623 ;;
624 engenius,epg5000)
625 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
626 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
627 ;;
628 engenius,ews511ap)
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"
633 ;;
634 enterasys,ws-ap3705i)
635 label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr)
636 ;;
637 hak5,lan-turtle|\
638 hak5,packet-squirrel)
639 label_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
640 ;;
641 iodata,etg3-r)
642 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
643 wan_mac=$(macaddr_add "$lan_mac" -1)
644 label_mac=$wan_mac
645 ;;
646 iodata,wn-ac1167dgr|\
647 iodata,wn-ac1600dgr|\
648 iodata,wn-ac1600dgr2|\
649 iodata,wn-ag300dgr)
650 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
651 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
652 label_mac=$wan_mac
653 ;;
654 jjplus,ja76pf2)
655 wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
656 lan_mac=$(macaddr_add "$wan_mac" 1)
657 ;;
658 mercury,mw4530r-v1|\
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)
664 ;;
665 nec,wf1200cr|\
666 nec,wg1200cr)
667 lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
668 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
669 label_mac=$wan_mac
670 ;;
671 nec,wg800hp)
672 lan_mac=$(mtd_get_mac_text board_data 0x280)
673 wan_mac=$(mtd_get_mac_text board_data 0x480)
674 label_mac=$wan_mac
675 ;;
676 netgear,wndr3700|\
677 netgear,wndr3700-v2|\
678 netgear,wndr3800|\
679 netgear,wndrmac-v1|\
680 netgear,wndrmac-v2)
681 lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)")
682 ;;
683 phicomm,k2t)
684 lan_mac=$(k2t_get_mac "lan_mac")
685 wan_mac=$(k2t_get_mac "wan_mac")
686 ;;
687 rosinson,wr818)
688 wan_mac=$(mtd_get_mac_binary factory 0x0)
689 lan_mac=$(macaddr_setbit_la "$wan_mac")
690 ;;
691 sitecom,wlr-7100|\
692 sitecom,wlr-8100)
693 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
694 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
695 label_mac=$lan_mac
696 ;;
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)
705 ;;
706 trendnet,tew-823dru)
707 lan_mac=$(mtd_get_mac_text mac 0x4)
708 wan_mac=$(mtd_get_mac_text mac 0x18)
709 label_mac=$wan_mac
710 ;;
711 ubnt,airrouter|\
712 ubnt,bullet-m-ar7240|\
713 ubnt,bullet-m-ar7241|\
714 ubnt,nanobridge-m|\
715 ubnt,nanostation-loco-m|\
716 ubnt,nanostation-m|\
717 ubnt,picostation-m|\
718 ubnt,powerbridge-m|\
719 ubnt,rocket-m|\
720 ubnt,unifi)
721 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
722 ;;
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)
729 ;;
730 ubnt,routerstation|\
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)
734 ;;
735 wd,mynet-wifi-rangeextender)
736 lan_mac=$(nvram get et0macaddr)
737 ;;
738 xiaomi,aiot-ac2350)
739 lan_mac=$(mtd_get_mac_binary art 0x1002)
740 ;;
741 zyxel,nbg6616)
742 label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
743 ;;
744 esac
745
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
749 }
750
751 board_config_update
752 board=$(board_name)
753 ath79_setup_interfaces $board
754 ath79_setup_macs $board
755 board_config_flush
756
757 exit 0