OpenWrt – Blame information for rev 4

Subversion Repositories:
Rev:
Rev Author Line No. Line
4 office 1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5  
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
8  
9 ar71xx_setup_interfaces()
10 {
11 local board="$1"
12  
13 case "$board" in
14 airgatewaypro)
15 ucidef_add_switch "switch0" \
16 "0@eth0" "4:lan" "5:wan"
17 ;;
18 airrouter|\
19 ap121|\
20 ap121-mini|\
21 ap96|\
22 dir-600-a1|\
23 dir-615-c1|\
24 dir-615-e1|\
25 dir-615-e4|\
26 hiwifi-hc6361|\
27 ja76pf|\
28 mc-mac1200r|\
29 minibox-v1|\
30 mynet-n600|\
31 oolite-v1|\
32 oolite-v5.2|\
33 oolite-v5.2-dev|\
34 qihoo-c301|\
35 r602n|\
36 rb-750|\
37 rb-751|\
38 som9331|\
39 t830|\
40 tew-632brp|\
41 tew-712br|\
42 tew-732br|\
43 tl-mr3220|\
44 tl-mr3220-v2|\
45 tl-mr3420|\
46 tl-wdr3320-v2|\
47 tl-wdr3500|\
48 tl-wr740n-v6|\
49 tl-wr741nd-v4|\
50 tl-wr840n-v2|\
51 tl-wr840n-v3|\
52 tl-wr841n-v11|\
53 tl-wr841n-v9|\
54 tl-wr842n-v3|\
55 whr-g301n|\
56 whr-hp-g300n|\
57 whr-hp-gn|\
58 wzr-hp-ag300h|\
59 zbt-we1526)
60 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
61 ucidef_add_switch "switch0" \
62 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
63 ;;
64 alfa-ap120c|\
65 all0305|\
66 antminer-s1|\
67 antminer-s3|\
68 antrouter-r1|\
69 ap121f|\
70 ap91-5g|\
71 aw-nr580|\
72 bullet-m|\
73 c-55|\
74 cap4200ag|\
75 cf-e380ac-v1|\
76 cf-e380ac-v2|\
77 cpe210-v2|\
78 dr342|\
79 eap120|\
80 eap300v2|\
81 eap7660d|\
82 el-mini|\
83 fritz300e|\
84 fritz450e|\
85 gl-usb150|\
86 hiveap-121|\
87 koala|\
88 lbe-m5|\
89 loco-m-xw|\
90 mr12|\
91 mr16|\
92 mr1750|\
93 mr1750v2|\
94 mr18|\
95 mr600|\
96 mr600v2|\
97 mr900|\
98 mr900v2|\
99 mynet-rext|\
100 pqi-air-pen|\
101 rb-411|\
102 rb-411u|\
103 rb-911-2hn|\
104 rb-911-5hn|\
105 rb-911g-2hpnd|\
106 rb-911g-5hpacd|\
107 rb-911g-5hpnd|\
108 rb-912uag-2hpnd|\
109 rb-912uag-5hpnd|\
110 rb-921gs-5hpacd-r2|\
111 rb-lhg-5nd|\
112 rb-mapl-2nd|\
113 rb-sxt2n|\
114 rb-sxt5n|\
115 rb-wap-2nd|\
116 rb-wapg-5hact2hnd|\
117 re355|\
118 re450|\
119 rocket-m-xw|\
120 sc300m |\
121 tl-mr10u|\
122 tl-mr11u|\
123 tl-mr12u|\
124 tl-mr13u|\
125 tl-mr3020|\
126 tl-mr3040|\
127 tl-mr3040-v2|\
128 tl-wa701nd-v2|\
129 tl-wa7210n-v2|\
130 tl-wa750re|\
131 tl-wa801nd-v2|\
132 tl-wa830re-v2|\
133 tl-wa850re|\
134 tl-wa850re-v2|\
135 tl-wa855re-v1|\
136 tl-wa901nd|\
137 tl-wa901nd-v2|\
138 tl-wa901nd-v3|\
139 tl-wa901nd-v4|\
140 tl-wa901nd-v5|\
141 tl-wr703n|\
142 tl-wr802n-v1|\
143 tl-wr802n-v2|\
144 tl-wr902ac-v1|\
145 ts-d084|\
146 tube2h|\
147 unifi|\
148 unifiac-lite|\
149 wi2a-ac200i|\
150 wifi-pineapple-nano|\
151 wndap360|\
152 wp543)
153 ucidef_set_interface_lan "eth0"
154 ;;
155 a40|\
156 a60|\
157 alfa-ap96|\
158 alfa-nx|\
159 archer-c25-v1|\
160 dr344|\
161 gl-ar150|\
162 gl-ar300m|\
163 gl-x750|\
164 gl-domino|\
165 gl-inet|\
166 gl-mifi|\
167 jwap003|\
168 om2p-hsv4|\
169 om2pv4|\
170 pb42|\
171 pb44|\
172 rb-951ui-2hnd|\
173 rb-952ui-5ac2nd|\
174 routerstation|\
175 tl-wr710n|\
176 tl-wr720n-v3|\
177 tl-wr810n|\
178 tl-wr810n-v2|\
179 wpe72|\
180 wrtnode2q)
181 ucidef_set_interfaces_lan_wan "eth1" "eth0"
182 ;;
183 gl-ar750s)
184 ucidef_add_switch "switch0" \
185 "0@eth0" "2:lan:2" "3:lan:1" "1:wan"
186 ;;
187 gl-x1200)
188 ucidef_add_switch "switch0" \
189 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
190 ;;
191 gl-mifi-v3)
192 ucidef_set_interface_wan "eth0"
193 ;;
194 rb-750-r2|\
195 rb-750p-pbr2|\
196 rb-750up-r2|\
197 rb-951ui-2nd)
198 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
199 ucidef_add_switch "switch0" \
200 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
201 ;;
202 all0258n|\
203 all0315n|\
204 dlan-hotspot|\
205 dlan-pro-500-wp|\
206 ens202ext|\
207 ja76pf2|\
208 rocket-m-ti|\
209 ubnt-unifi-outdoor)
210 ucidef_set_interface_lan "eth0 eth1"
211 ;;
212 wzr-hp-g300nh2)
213 ucidef_add_switch "switch0" \
214 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
215 ;;
216 ap132|\
217 ap136|\
218 ap152|\
219 rb-750gl|\
220 rb-751g|\
221 rb-951g-2hnd|\
222 rb-962uigs-5hact2hnt|\
223 wlr8100|\
224 wzr-hp-g450h)
225 ucidef_add_switch "switch0" \
226 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
227 ;;
228 ap135-020|\
229 ap136-020|\
230 bhr-4grv2|\
231 tew-823dru|\
232 tl-wr1043nd-v2|\
233 wzr-450hp2)
234 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
235 ucidef_add_switch "switch0" \
236 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
237 ;;
238 ap136-010|\
239 ap147-010|\
240 nbg6616|\
241 nbg6716)
242 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
243 ucidef_add_switch "switch0" \
244 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
245 ;;
246 ap143|\
247 rb-433|\
248 rb-433u)
249 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
250 ucidef_add_switch "switch0" \
251 "1:lan" "2:lan" "5@eth1"
252 ;;
253 archer-c5|\
254 archer-c7|\
255 tl-wdr4900-v2)
256 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
257 ucidef_add_switch "switch0" \
258 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
259 ;;
260 archer-c58-v1|\
261 archer-c59-v1|\
262 fritz4020|\
263 rb-450g)
264 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
265 ucidef_add_switch "switch0" \
266 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
267 ;;
268 archer-c60-v1|\
269 archer-c60-v2)
270 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
271 ucidef_add_switch "switch0" \
272 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
273 ;;
274 arduino-yun|\
275 dir-505-a1|\
276 tl-wa801nd-v3)
277 ucidef_set_interface_lan "eth1"
278 ;;
279 bsb)
280 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
281 ucidef_add_switch "switch0" \
282 "0@eth1" "1:lan" "3:lan"
283 ;;
284 c-60)
285 ucidef_add_switch "switch0" \
286 "0@eth0" "3:wan" "4:lan"
287 ;;
288 cap324|\
289 rme-eg200)
290 ucidef_set_interface_lan "eth0" "dhcp"
291 ;;
292 cf-e375ac|\
293 rb-map-2nd)
294 ucidef_add_switch "switch0" \
295 "0@eth0" "1:wan" "2:lan"
296 ;;
297 cf-e385ac)
298 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
299 ucidef_add_switch "switch0" \
300 "0@eth0" "2:lan" "1:wan" "6@eth1"
301 ;;
302 cpe210|\
303 cpe510|\
304 wbs210|\
305 wbs510)
306 ucidef_add_switch "switch0" \
307 "0@eth0" "5:lan" "4:wan"
308 ;;
309 cr3000)
310 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
311 ucidef_add_switch "switch0" \
312 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
313 ;;
314 cr5000|\
315 dgl-5500-a1|\
316 dhp-1565-a1|\
317 dir-825-c1|\
318 dir-835-a1|\
319 esr900|\
320 mynet-n750|\
321 sr3200|\
322 tl-wr1043n-v5)
323 ucidef_add_switch "switch0" \
324 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
325 ;;
326 dap-2695-a1)
327 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
328 ;;
329 rb-941-2nd)
330 ucidef_add_switch "switch0" \
331 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
332 ;;
333 db120|\
334 rb-2011il|\
335 rb-2011ils|\
336 rb-2011l|\
337 rb-2011uas|\
338 rb-2011uas-2hnd|\
339 rb-2011uias|\
340 rb-2011uias-2hnd)
341 case "$board" in
342 rb-2011ils|\
343 rb-2011uas*|\
344 rb-2011uias|\
345 rb-2011uias-2hnd)
346 ucidef_add_switch "switch0" \
347 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
348 ;;
349 *)
350 ucidef_add_switch "switch0" \
351 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
352 ;;
353 esac
354  
355 ucidef_add_switch "switch1" \
356 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
357 ;;
358 dir-615-i1|\
359 omy-g1|\
360 r6100|\
361 smart-300|\
362 tl-wdr6500-v2|\
363 tl-wr940n-v4|\
364 tl-wr940n-v6|\
365 tl-wr941nd-v6|\
366 wnr1000-v2|\
367 wnr2000-v4|\
368 wnr2200|\
369 wnr612-v2|\
370 wpn824n)
371 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
372 ucidef_add_switch "switch0" \
373 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
374 ;;
375 tl-mr6400)
376 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0"
377 ucidef_add_switch "switch0" \
378 "0@eth0" "1:lan" "2:lan" "3:lan"
379 ;;
380 dir-825-b1|\
381 nbg460n_550n_550nh|\
382 tew-673gru|\
383 wzr-hp-g300nh)
384 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
385 ucidef_add_switch "switch0" \
386 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
387 ;;
388 dlan-pro-1200-ac)
389 ucidef_set_interface_lan "eth0"
390 ucidef_add_switch "switch0" \
391 "0u@eth0" "2:lan" "3:lan" "4:lan"
392 ucidef_add_switch_attr "switch0" "enable" "false"
393 ;;
394 e1700ac-v2|\
395 e750g-v8|\
396 unifiac-pro|\
397 xd3200)
398 ucidef_add_switch "switch0" \
399 "0@eth0" "2:lan" "3:wan"
400 ;;
401 e558-v2)
402 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
403 ucidef_add_switch "switch0" \
404 "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan"
405 ;;
406 ebr-2310-c1)
407 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
408 ucidef_add_switch "switch0" \
409 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
410 ;;
411 el-m150)
412 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
413 ucidef_add_switch "switch0" \
414 "0:lan" "1:lan" "3@eth1"
415 ;;
416 dir-869-a1|\
417 epg5000|\
418 esr1750|\
419 tl-wr1043nd-v4|\
420 wndr3700v4|\
421 wndr4300)
422 ucidef_add_switch "switch0" \
423 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
424 ;;
425 ew-balin)
426 ucidef_set_interface_raw "usb2" "usb0" "static"
427 ucidef_add_switch "switch0" \
428 "0@eth0" "5:lan:4" "4:lan:5" "3:wan"
429 ;;
430 ew-dorin)
431 ucidef_add_switch "switch0" \
432 "0@eth0" "1:lan" "2:lan" "3:wan"
433 ;;
434 ew-dorin-router)
435 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
436 ucidef_add_switch "switch0" \
437 "0@eth0" "2:lan" "3:lan"
438 ;;
439 dw33d|\
440 f9k1115v2)
441 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
442 ucidef_add_switch "switch0" \
443 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
444 ;;
445 gl-ar300|\
446 wnr2000-v3)
447 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
448 ucidef_add_switch "switch0" \
449 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
450 ;;
451 gl-ar750|\
452 rb-435g)
453 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
454 ucidef_add_switch "switch0" \
455 "0@eth1" "1:lan" "2:lan"
456 ;;
457 jwap230)
458 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
459 ucidef_add_switch "switch0" \
460 "0@eth0" "1:lan" "5:wan" "6@eth1"
461 ;;
462 nanostation-m-xw)
463 ucidef_add_switch "switch0" \
464 "0@eth0" "5:lan" "1:wan"
465 ;;
466 onion-omega)
467 ucidef_set_interface_lan "wlan0"
468 ;;
469 rb-450)
470 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
471 ucidef_add_switch "switch0" \
472 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
473 ;;
474 routerstation-pro)
475 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
476 ucidef_add_switch "switch0" \
477 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
478 ;;
479 rb-493g)
480 ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth1.2"
481 ucidef_add_switch "switch0" \
482 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
483 ucidef_add_switch "switch1" \
484 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan"
485 ;;
486 rut900)
487 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
488 ucidef_add_switch "switch0" \
489 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
490 ;;
491 tellstick-znet-lite)
492 ucidef_set_interface_wan "eth0"
493 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
494 ;;
495 tl-mr3420-v2|\
496 tl-wr841n-v8|\
497 tl-wr842n-v2|\
498 tl-wr941nd-v5|\
499 tl-wr942n-v1)
500 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
501 ucidef_add_switch "switch0" \
502 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
503 ;;
504 archer-c7-v4|\
505 archer-c7-v5|\
506 tl-wdr4300|\
507 tl-wr1041n-v2)
508 ucidef_add_switch "switch0" \
509 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
510 ;;
511 tl-wpa8630)
512 ucidef_add_switch "switch0" \
513 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
514 ;;
515 tl-wr1043nd)
516 ucidef_add_switch "switch0" \
517 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
518 ;;
519 tl-wr2543n)
520 ucidef_add_switch "switch0" \
521 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
522 ;;
523 tl-wr841n-v1|\
524 tl-wr941nd)
525 ucidef_set_interface_raw "eth" "eth0"
526 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
527 ;;
528 tl-wr741nd|\
529 tl-wr841n-v7)
530 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
531 ucidef_add_switch "switch0" \
532 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
533 ;;
534 uap-pro|\
535 wpj342)
536 ucidef_add_switch "switch0" \
537 "0@eth0" "1:lan" "2:wan"
538 ;;
539 wndr3700|\
540 wndr3700v2|\
541 wndr3800|\
542 wndr3800ch)
543 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
544 ucidef_add_switch "switch0" \
545 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
546  
547 ucidef_add_switch_attr "switch0" "blinkrate" 2
548 ucidef_add_switch_port_attr "switch0" 1 led 6
549 ucidef_add_switch_port_attr "switch0" 2 led 9
550 ucidef_add_switch_port_attr "switch0" 5 led 2
551 ;;
552 wpj344)
553 ucidef_add_switch "switch0" \
554 "0@eth0" "3:lan" "2:wan"
555 ;;
556 wpj558)
557 ucidef_add_switch "switch0" \
558 "5:lan" "1:wan" "6@eth0"
559 ;;
560 wpj563)
561 ucidef_add_switch "switch0" \
562 "0@eth0" "2:lan" "3:wan"
563 ;;
564 wrt160nl)
565 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
566 ucidef_add_switch "switch0" \
567 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
568 ;;
569 wzr-hp-g450h)
570 ucidef_add_switch "switch0" \
571 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
572 ;;
573 z1)
574 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
575 ucidef_add_switch "switch0" \
576 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
577 ;;
578 *)
579 ucidef_set_interfaces_lan_wan "eth0" "eth1"
580 ;;
581 esac
582 }
583  
584 ar71xx_setup_macs()
585 {
586 local board="$1"
587 local lan_mac=""
588 local wan_mac=""
589  
590 case $board in
591 dgl-5500-a1|\
592 dir-825-c1)
593 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
594 ;;
595 dhp-1565-a1|\
596 dir-835-a1|\
597 wndr3700v4|\
598 wndr4300)
599 lan_mac=$(mtd_get_mac_binary caldata 0)
600 wan_mac=$(mtd_get_mac_binary caldata 6)
601 ;;
602 fritz300e)
603 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
604 ;;
605 tl-wr1043n-v5|\
606 tl-wr1043nd-v4)
607 lan_mac=$(mtd_get_mac_binary product-info 8)
608 wan_mac=$(macaddr_add "$lan_mac" 1)
609 ;;
610 esr900)
611 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
612 ;;
613 dir-869-a1|\
614 mynet-n750)
615 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
616 ;;
617 wlr8100)
618 lan_mac=$(mtd_get_mac_ascii u-boot-env "ethaddr")
619 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
620 ;;
621 wpj344|\
622 wpj558)
623 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
624 ;;
625 esac
626  
627 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
628 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
629 }
630  
631 board_config_update
632 board=$(board_name)
633 ar71xx_setup_interfaces $board
634 ar71xx_setup_macs $board
635 board_config_flush
636  
637 exit 0