ramips: add support for Edimax RG21S
[openwrt/openwrt.git] / target / linux / ramips / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions.sh
4 . /lib/functions/uci-defaults.sh
5 . /lib/functions/system.sh
6
7 ramips_setup_rt3x5x_vlans()
8 {
9 if [ ! -x /sbin/swconfig ]; then
10 # legacy default
11 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
12 return
13 fi
14 local wanports=""
15 local lanports=""
16 for port in 5 4 3 2 1 0; do
17 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
18 continue
19 fi
20 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
21 wanports="$port:wan $wanports"
22 else
23 lanports="$port:lan $lanports"
24 fi
25 done
26 ucidef_add_switch "rt305x" $lanports $wanports "6t@eth0"
27 }
28
29 ramips_setup_interfaces()
30 {
31 local board="$1"
32
33 case $board in
34 accton,wr6202|\
35 alfa-network,w502u|\
36 netcore,nw718|\
37 petatel,psr-680w|\
38 skyline,sl-r7205|\
39 upvel,ur-336un)
40 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
41 ;;
42 adslr,g7|\
43 afoundry,ew1200|\
44 aigale,ai-br100|\
45 alfa-network,ac1200rm|\
46 asus,rt-n12p|\
47 buffalo,whr-g300n|\
48 d-team,pbr-m1|\
49 dlink,dir-300-b7|\
50 dlink,dir-320-b1|\
51 dlink,dir-610-a1|\
52 dlink,dir-810l|\
53 dlink,dwr-116-a1|\
54 dlink,dwr-921-c1|\
55 dlink,dwr-922-e2|\
56 edimax,3g-6200n|\
57 firefly,firewrt|\
58 hilink,hlk-rm04|\
59 hiwifi,hc5661a|\
60 hiwifi,hc5761a|\
61 hiwifi,hc5962|\
62 mediatek,ap-mt7621a-v60|\
63 mediatek,mt7621-eval-board|\
64 mediatek,mt7628an-eval-board|\
65 mercury,mac1200r-v2|\
66 mqmaker,witi|\
67 mtc,wr1201|\
68 netis,wf-2881|\
69 nixcore,x1-16m|\
70 nixcore,x1-8m|\
71 ohyeah,oy-0001|\
72 phicomm,k2p|\
73 phicomm,psg1208|\
74 phicomm,psg1218a|\
75 planex,db-wrt01|\
76 planex,mzk-750dhp|\
77 planex,mzk-w300nh2|\
78 planex,vr500|\
79 samknows,whitebox-v8|\
80 sanlinking,d240|\
81 storylink,sap-g3200u3|\
82 telco-electronics,x1|\
83 totolink,a7000r|\
84 totolink,lr1200|\
85 unielec,u7621-06-256m-16m|\
86 unielec,u7621-06-512m-64m|\
87 wavlink,wl-wn570ha1|\
88 wavlink,wl-wn575a3|\
89 xiaomi,miwifi-mini|\
90 xiaomi,miwifi-nano|\
91 xzwifi,creativebox-v1|\
92 youku,yk-l2|\
93 youku,yk1|\
94 zbtlink,zbt-ape522ii|\
95 zbtlink,zbt-we1326|\
96 zbtlink,zbt-we3526|\
97 zbtlink,zbt-we826-16m|\
98 zbtlink,zbt-we826-32m|\
99 zbtlink,zbt-we826-e|\
100 zbtlink,zbt-wg2626|\
101 zbtlink,zbt-wg3526-16m|\
102 zbtlink,zbt-wg3526-32m|\
103 zbtlink,zbt-wr8305rt|\
104 zyxel,keenetic|\
105 zyxel,keenetic-omni)
106 ucidef_add_switch "switch0" \
107 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
108 ;;
109 airlink101,ar670w|\
110 airlink101,ar725w|\
111 asus,rt-ac51u|\
112 rakwireless,rak633)
113 ucidef_add_switch "switch0" \
114 "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
115 ;;
116 alfa-network,awusfree1|\
117 alfa-network,tube-e4g|\
118 buffalo,wli-tx4-ag300n|\
119 buffalo,wmr-300|\
120 dlink,dap-1522-a1|\
121 dlink,dch-m225|\
122 d-team,pbr-d1|\
123 elecom,wrh-300cr|\
124 huawei,d105|\
125 kimax,u25awf-h1|\
126 loewe,wmdr-143n|\
127 netgear,ex2700|\
128 netgear,ex3700|\
129 netgear,wn3000rp-v3|\
130 omnima,hpm|\
131 planex,cs-qr10|\
132 planex,mzk-ex300np|\
133 planex,mzk-ex750np|\
134 ravpower,wd03|\
135 sercomm,na930|\
136 tama,w06|\
137 tplink,tl-mr3020-v3|\
138 tplink,tl-wr802n-v4)
139 ucidef_set_interface_lan "eth0"
140 ;;
141 allnet,all0256n-4m|\
142 allnet,all0256n-8m|\
143 allnet,all5002|\
144 allnet,all5003|\
145 dlink,dcs-930l-b1|\
146 dlink,dcs-930|\
147 edimax,ew-7476rpc|\
148 edimax,ew-7478ac|\
149 hame,mpr-a2|\
150 hauppauge,broadway|\
151 hootoo,ht-tm02|\
152 intenso,memory2move|\
153 kimax,u35wf|\
154 mediatek,linkit-smart-7688|\
155 microduino,microwrt|\
156 mikrotik,rbm11g|\
157 netgear,wnce2001|\
158 onion,omega2p|\
159 onion,omega2|\
160 tenda,3g150b|\
161 tenda,3g300m|\
162 tenda,w150m|\
163 thunder,timecloud|\
164 tplink,tl-wa801nd-v5|\
165 unbranded,a5-v11|\
166 wansview,ncs601w|\
167 widora,neo-16m|\
168 widora,neo-32m|\
169 yukai,bocco|\
170 zbtlink,zbt-cpe102|\
171 zorlik,zl5900v2|\
172 zte,q7)
173 ucidef_add_switch "switch0"
174 ucidef_add_switch_attr "switch0" "enable" "false"
175 ucidef_set_interface_lan "eth0"
176 ;;
177 alphanetworks,asl26555-8m|\
178 alphanetworks,asl26555-16m|\
179 asus,rp-n53)
180 ucidef_add_switch "switch0" \
181 "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
182 ;;
183 argus,atp-52b|\
184 asiarf,awm002-evb-4m|\
185 asiarf,awm002-evb-8m|\
186 asus,rt-ac57u|\
187 asus,rt-n14u|\
188 bdcom,wap2100-sk|\
189 dlink,dir-645|\
190 glinet,gl-mt300a|\
191 glinet,gl-mt300n|\
192 glinet,gl-mt750|\
193 hilink,hlk-7628n|\
194 hiwifi,hc5661|\
195 hiwifi,hc5861b|\
196 jcg,jhr-n805r|\
197 jcg,jhr-n825r|\
198 jcg,jhr-n926r|\
199 mikrotik,rb750gr3|\
200 mikrotik,rbm33g|\
201 planex,mzk-wdpr|\
202 skylab,skw92a|\
203 tplink,archer-c20-v4|\
204 tplink,archer-c20i|\
205 tplink,archer-c50-v3|\
206 tplink,archer-c50-v4|\
207 tplink,tl-mr3420-v5|\
208 tplink,tl-wr840n-v4|\
209 tplink,tl-wr840n-v5|\
210 tplink,tl-wr841n-v13|\
211 tplink,tl-wr841n-v14|\
212 tplink,tl-wr842n-v5|\
213 unielec,u7628-01-128m-16m|\
214 ubiquiti,edgerouterx|\
215 ubiquiti,edgerouterx-sfp|\
216 upvel,ur-326n4g|\
217 wrtnode,wrtnode|\
218 wrtnode,wrtnode2p|\
219 wrtnode,wrtnode2r|\
220 youhua,wr1200js|\
221 zbtlink,zbt-wa05|\
222 zyxel,keenetic-extra-ii)
223 ucidef_add_switch "switch0" \
224 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
225 ;;
226 asiarf,ap7621-001)
227 ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
228 ;;
229 asiarf,awapn2403)
230 ucidef_add_switch "switch0" \
231 "0:lan" "1:wan" "6@eth0"
232 ;;
233 asus,rt-n15|\
234 belkin,f9k1109v1|\
235 sitecom,wl-351)
236 ucidef_add_switch "switch0" \
237 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
238 ;;
239 asus,rt-n56u)
240 ucidef_add_switch "switch0" \
241 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
242 ;;
243 asus,wl-330n|\
244 easyacc,wizard-8800|\
245 kingston,mlwg2)
246 ucidef_set_interface_lan "eth0.1"
247 ;;
248 aximcom,mr-102n|\
249 kingston,mlw221)
250 ucidef_set_interface_lan "eth0.2"
251 ;;
252 belkin,f5d8235-v1|\
253 belkin,f5d8235-v2|\
254 buffalo,wzr-agl300nh|\
255 ralink,v11st-fe|\
256 trendnet,tew-714tru)
257 ucidef_add_switch "switch0" \
258 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
259 ;;
260 buffalo,wcr-1166ds)
261 ucidef_add_switch "switch0" \
262 "3:lan" "4:wan" "6@eth0"
263 ;;
264 buffalo,whr-300hp2|\
265 buffalo,whr-600d|\
266 buffalo,wsr-1166dhp|\
267 buffalo,wsr-600dhp)
268 ucidef_add_switch "switch0" \
269 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan:5" "6@eth0"
270 ;;
271 buffalo,whr-1166d)
272 ucidef_add_switch "switch0" \
273 "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
274 ;;
275 comfast,cf-wr800n|\
276 hnet,c108)
277 ucidef_add_switch "switch0" \
278 "4:lan" "6t@eth0"
279 ;;
280 cudy,wr1000)
281 ucidef_add_switch "switch0" \
282 "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
283 ;;
284 dlink,dir-510l|\
285 glinet,vixmini|\
286 netgear,ex6150|\
287 tplink,re350-v1|\
288 tplink,re650-v1)
289 ucidef_add_switch "switch0" \
290 "0:lan" "6@eth0"
291 ;;
292 dlink,dir-615-h1|\
293 d-team,newifi-d2|\
294 wevo,11acnas|\
295 wevo,w2914ns-v2|\
296 zbtlink,zbt-we2026)
297 ucidef_add_switch "switch0" \
298 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
299 ;;
300 dlink,dir-860l-b1|\
301 elecom,wrc-1167ghbk2-s|\
302 elecom,wrc-1900gst|\
303 elecom,wrc-2533gst|\
304 huawei,hg255d|\
305 iodata,wn-ax1167gr|\
306 iodata,wn-gx300gr|\
307 iptime,a604m)
308 ucidef_add_switch "switch0" \
309 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
310 ;;
311 dlink,dwr-118-a1)
312 ucidef_add_switch "switch0" \
313 "1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
314 ;;
315 dlink,dwr-118-a2)
316 ucidef_add_switch "switch0" \
317 "1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0"
318 ;;
319 duzun,dm06)
320 ucidef_add_switch "switch0" \
321 "1:lan" "0:wan" "6@eth0"
322 ;;
323 edimax,br-6475nd)
324 ucidef_add_switch "switch0" \
325 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
326 ;;
327 edimax,br-6478ac-v2|\
328 tplink,archer-c2-v1)
329 ucidef_add_switch "switch1" \
330 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
331 ;;
332 fon,fon2601)
333 ucidef_add_switch "switch0" \
334 "0:lan" "4:wan" "6@eth0"
335 ;;
336 edimax,rg21s)
337 ucidef_add_switch "switch0" \
338 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
339 ;;
340 gehua,ghl-r-001)
341 ucidef_add_switch "switch0" \
342 "0:lan" "1:lan" "2:lan" "4:wan" "6@eth0"
343 ;;
344 glinet,gl-mt300n-v2)
345 ucidef_add_switch "switch0" \
346 "1:lan" "0:wan" "6@eth0"
347 ;;
348 gnubee,gb-pc1|\
349 gnubee,gb-pc2)
350 ucidef_add_switch "switch0" \
351 "0:lan" "4:lan" "6@eth0"
352 ;;
353 head-weblink,hdrm200)
354 ucidef_add_switch "switch0" \
355 "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
356 ;;
357 hiwifi,hc5761)
358 ucidef_add_switch "switch0" \
359 "1:lan" "4:lan" "0:wan" "6@eth0"
360 ;;
361 hiwifi,hc5861)
362 ucidef_add_switch "switch0" \
363 "0:lan" "1:lan" "5:wan" "6@eth0"
364 ;;
365 iodata,wn-ac1167gr|\
366 iodata,wn-ac733gr3)
367 ucidef_add_switch "switch1" \
368 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
369 ;;
370 lava,lr-25g001|\
371 sitecom,wlr-6000|\
372 trendnet,tew-691gr|\
373 trendnet,tew-692gr)
374 ucidef_add_switch "switch0" \
375 "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
376 ;;
377 lenovo,newifi-d1)
378 ucidef_add_switch "switch0" \
379 "1:lan:2" "2:lan:1" "4:wan" "6@eth0"
380 ;;
381 lenovo,newifi-y1|\
382 zbtlink,zbt-we1226)
383 ucidef_add_switch "switch0" \
384 "0:lan:2" "1:lan:1" "4:wan" "6@eth0"
385 ;;
386 lenovo,newifi-y1s)
387 ucidef_add_switch "switch0" \
388 "1:lan:4" "2:lan:3" "4:lan:2" "5:lan:1" "0:wan" "6@eth0"
389 ;;
390 linksys,e1700|\
391 ralink,mt7620a-mt7530-evb)
392 ucidef_add_switch "switch1" \
393 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
394 ;;
395 linksys,re6500)
396 ucidef_add_switch "switch0" \
397 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "6@eth0"
398 ;;
399 netgear,r6120|\
400 netgear,r6220|\
401 netgear,r6260|\
402 netgear,r6350|\
403 netgear,r6850|\
404 netgear,wndr3700-v5)
405 ucidef_add_switch "switch0" \
406 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
407 ;;
408 nexx,wt1520-4m|\
409 nexx,wt1520-8m|\
410 vonets,var11n-300)
411 ucidef_add_switch "switch0" \
412 "0:lan" "4:wan" "6@eth0"
413 ;;
414 nexx,wt3020-4m|\
415 nexx,wt3020-8m)
416 ucidef_add_switch "switch0" \
417 "4:lan" "0:wan" "6@eth0"
418 ;;
419 phicomm,k2g)
420 ucidef_add_switch "switch0" \
421 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5:wan" "6@eth0"
422 ;;
423 phicomm,psg1218b)
424 ucidef_add_switch "switch0" \
425 "0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "6@eth0"
426 ;;
427 planex,mzk-dp150n|\
428 vocore,vocore-8m|\
429 vocore,vocore-16m)
430 ucidef_add_switch "switch0" \
431 "0:lan" "4:lan" "6t@eth0"
432 ;;
433 samsung,cy-swr1100)
434 ucidef_add_switch "switch0" \
435 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
436 ;;
437 sparklan,wcr-150gn|\
438 zbtlink,we1026-5g-16m)
439 ucidef_add_switch "switch0" \
440 "0:lan" "6t@eth0"
441 ;;
442 tplink,archer-c20-v1|\
443 tplink,archer-c50-v1)
444 ucidef_add_switch "switch0" \
445 "1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
446 ;;
447 tplink,archer-mr200)
448 ucidef_add_switch "switch0" \
449 "0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0"
450 ucidef_set_interface_wan "usb0"
451 ;;
452 tplink,tl-wr902ac-v3)
453 ucidef_add_switch "switch0" \
454 "4:lan" "6@eth0"
455 ;;
456 trendnet,tew-638apb-v2)
457 ucidef_add_switch "switch0" \
458 "4:lan" "6@eth0"
459 ;;
460 vocore,vocore2|\
461 vocore,vocore2-lite)
462 ucidef_add_switch "switch0" \
463 "0:lan" "2:lan" "6t@eth0"
464 ;;
465 wiznet,wizfi630a)
466 ucidef_add_switch "switch0" \
467 "0:lan" "1:lan" "2:wan" "6@eth0"
468 ;;
469 wiznet,wizfi630s)
470 ucidef_add_switch "switch0" \
471 "0:wan" "3:lan" "4:lan" "6@eth0"
472 ;;
473 xiaomi,mir3g)
474 ucidef_add_switch "switch0" \
475 "2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
476 ;;
477 xiaomi,mir3p)
478 ucidef_add_switch "switch0" \
479 "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
480 ;;
481 xiaomi,mir4a-100m)
482 ucidef_add_switch "switch0" \
483 "4:lan:1" "2:lan:2" "0:wan" "6@eth0"
484 ;;
485 zyxel,keenetic-omni-ii)
486 ucidef_add_switch "switch0" \
487 "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
488 ;;
489 zyxel,keenetic-start)
490 ucidef_add_switch "switch0" \
491 "0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6@eth0"
492 ;;
493 zyxel,keenetic-viva)
494 ucidef_add_switch "switch1" \
495 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0"
496 ;;
497 *)
498 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
499 if [ -n "${RT3X5X}" ]; then
500 ramips_setup_rt3x5x_vlans
501 else
502 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
503 fi
504 ;;
505 esac
506 }
507
508 ramips_setup_macs()
509 {
510 local board="$1"
511 local lan_mac=""
512 local wan_mac=""
513
514 case $board in
515 8devices,carambola|\
516 alfa-network,w502u|\
517 arcwireless,freestation5|\
518 lenovo,newifi-y1|\
519 lenovo,newifi-y1s|\
520 netgear,wnce2001|\
521 ohyeah,oy-0001|\
522 phicomm,k2g|\
523 skylab,skw92a|\
524 totolink,lr1200)
525 wan_mac=$(mtd_get_mac_binary factory 0x2e)
526 ;;
527 dlink,dir-300-b7|\
528 dlink,dir-320-b1|\
529 dlink,dir-620-a1|\
530 engenius,esr-9753|\
531 hame,mpr-a1|\
532 hauppauge,broadway|\
533 huawei,d105|\
534 hilink,hlk-7628n|\
535 hilink,hlk-rm04|\
536 nexaira,bc2|\
537 petatel,psr-680w|\
538 skyline,sl-r7205)
539 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
540 wan_mac=$(macaddr_add "$lan_mac" 1)
541 ;;
542 asus,rt-ac57u|\
543 d-team,newifi-d2|\
544 d-team,pbr-m1|\
545 elecom,wrc-1167ghbk2-s|\
546 elecom,wrc-1900gst|\
547 elecom,wrc-2533gst|\
548 lenovo,newifi-d1|\
549 phicomm,k2p|\
550 planex,vr500|\
551 samknows,whitebox-v8|\
552 youku,yk-l2|\
553 zbtlink,zbt-we3526)
554 wan_mac=$(mtd_get_mac_binary factory 0xe006)
555 ;;
556 asus,rt-n56u)
557 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
558 wan_mac=$(mtd_get_mac_binary factory 0x8004)
559 ;;
560 belkin,f9k1109v1)
561 wan_mac=$(mtd_get_mac_ascii uboot-env HW_WAN_MAC)
562 lan_mac=$(mtd_get_mac_ascii uboot-env HW_LAN_MAC)
563 label_mac=$wan_mac
564 ;;
565 buffalo,wcr-1166ds|\
566 buffalo,wsr-1166dhp)
567 local index="$(find_mtd_index "board_data")"
568 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
569 lan_mac=$wan_mac
570 ;;
571 buffalo,whr-1166d|\
572 buffalo,whr-300hp2|\
573 buffalo,whr-600d|\
574 buffalo,whr-g300n|\
575 buffalo,wsr-600dhp|\
576 glinet,gl-mt300n-v2|\
577 zyxel,keenetic-start)
578 # This empty case has to be kept for devices without any MAC address adjustments
579 ;;
580 cudy,wr1000)
581 wan_mac=$(mtd_get_mac_binary factory 0x2e)
582 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
583 ;;
584 dlink,dch-m225|\
585 samsung,cy-swr1100)
586 lan_mac=$(mtd_get_mac_ascii factory lanmac)
587 ;;
588 dlink,dir-510l|\
589 dlink,dwr-116-a1|\
590 dlink,dwr-118-a1|\
591 dlink,dwr-118-a2|\
592 dlink,dwr-921-c1|\
593 dlink,dwr-922-e2|\
594 lava,lr-25g001)
595 wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
596 lan_mac=$(macaddr_add "$wan_mac" 1)
597 label_mac=$wan_mac
598 ;;
599 dlink,dir-615-d|\
600 dlink,dir-615-h1|\
601 glinet,gl-mt300a|\
602 glinet,gl-mt300n|\
603 glinet,gl-mt750|\
604 zbtlink,zbt-wg3526-16m|\
605 zbtlink,zbt-wg3526-32m)
606 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
607 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
608 ;;
609 dlink,dir-645)
610 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
611 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
612 ;;
613 dlink,dir-860l-b1)
614 lan_mac=$(mtd_get_mac_ascii factory lanmac)
615 wan_mac=$(mtd_get_mac_ascii factory wanmac)
616 label_mac=$(cat /sys/class/ieee80211/phy1/macaddress)
617 ;;
618 dovado,tiny-ac)
619 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
620 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
621 ;;
622 edimax,br-6475nd)
623 wan_mac=$(mtd_get_mac_binary devdata 0x7)
624 ;;
625 edimax,br-6478ac-v2|\
626 netgear,r6260|\
627 netgear,r6350|\
628 netgear,r6850)
629 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
630 ;;
631 edimax,rg21s)
632 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
633 wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
634 ;;
635 hiwifi,hc5661|\
636 hiwifi,hc5661a|\
637 hiwifi,hc5761|\
638 hiwifi,hc5761a|\
639 hiwifi,hc5861|\
640 hiwifi,hc5861b|\
641 hiwifi,hc5962)
642 lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
643 label_mac=$lan_mac
644 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
645 wan_mac=$(macaddr_add "$lan_mac" 1)
646 ;;
647 iodata,wn-ac1167gr|\
648 iodata,wn-ac733gr3)
649 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -1)
650 ;;
651 iodata,wn-ax1167gr|\
652 iodata,wn-gx300gr|\
653 trendnet,tew-692gr)
654 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
655 ;;
656 iptime,a604m)
657 wan_mac=$(mtd_get_mac_binary u-boot 0x1fc40)
658 ;;
659 linksys,e1700)
660 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
661 ;;
662 mediatek,linkit-smart-7688|\
663 onion,omega2|\
664 onion,omega2p)
665 wan_mac=$(mtd_get_mac_binary factory 0x4)
666 lan_mac=$(mtd_get_mac_binary factory 0x2e)
667 ;;
668 mercury,mac1200r-v2)
669 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 1)
670 ;;
671 poray,m3|\
672 poray,m4-4m|\
673 poray,m4-8m|\
674 poray,x5|\
675 poray,x8)
676 lan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" -2)
677 ;;
678 sitecom,wlr-6000)
679 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x8004)" 2)
680 ;;
681 sparklan,wcr-150gn|\
682 wiznet,wizfi630a|\
683 zyxel,keenetic-omni|\
684 zyxel,keenetic-omni-ii|\
685 zyxel,keenetic-viva)
686 wan_mac=$(mtd_get_mac_binary factory 0x28)
687 ;;
688 tenda,w306r-v2)
689 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 5)
690 ;;
691 trendnet,tew-691gr)
692 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3)
693 ;;
694 vocore,vocore2|\
695 vocore,vocore2-lite)
696 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
697 ;;
698 xiaomi,mir3g)
699 lan_mac=$(mtd_get_mac_binary factory 0xe006)
700 ;;
701 xiaomi,mir3p)
702 lan_mac=$(mtd_get_mac_binary factory 0xe006)
703 label_mac=$lan_mac
704 ;;
705 xiaomi,miwifi-mini)
706 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
707 ;;
708 zbtlink,zbt-we1326)
709 wan_mac=$(mtd_get_mac_binary factory 0xe006)
710 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
711 ;;
712 *)
713 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
714 ;;
715 esac
716
717 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
718 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
719 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
720 }
721
722 board_config_update
723 board=$(board_name)
724 ramips_setup_interfaces $board
725 ramips_setup_macs $board
726 board_config_flush
727
728 exit 0