base-files: uci-defaults-new: remove reset/enable args of ucidef_add_switch()
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/uci-defaults-new.sh
7 . /lib/ar71xx.sh
8
9 board_config_update
10
11 ucidef_set_interface_loopback
12
13 board=$(ar71xx_board_name)
14
15
16 case "$board" in
17 all0315n |\
18 all0258n |\
19 ja76pf2|\
20 rocket-m-ti |\
21 ubnt-unifi-outdoor)
22 ucidef_set_interface_lan "eth0 eth1"
23 ;;
24
25 ap132 |\
26 wlr8100)
27 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
28 ucidef_add_switch "switch0" "1" "1"
29 ucidef_add_switch_ports "switch0" \
30 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
31 ;;
32
33 esr1750 |\
34 epg5000)
35 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
36 ucidef_add_switch "switch0" "1" "1"
37 ucidef_add_switch_ports "switch0" \
38 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
39 ;;
40
41 ap136-010 |\
42 ap147-010)
43 ucidef_set_interfaces_lan_wan "eth0" "eth1"
44 ucidef_add_switch "switch0" "1" "1"
45 ucidef_add_switch_ports "switch0" \
46 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
47 ;;
48
49 ap136-020 |\
50 ap135-020 |\
51 tl-wr1043nd-v2 |\
52 wzr-450hp2)
53 ucidef_set_interfaces_lan_wan "eth1" "eth0"
54 ucidef_add_switch "switch0" "1" "1"
55 ucidef_add_switch_ports "switch0" \
56 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
57 ;;
58
59 archer-c5 |\
60 archer-c7 |\
61 tl-wdr4900-v2)
62 ucidef_set_interfaces_lan_wan "eth1" "eth0"
63 ucidef_add_switch "switch0" "1" "1"
64 ucidef_add_switch_ports "switch0" \
65 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
66 ;;
67
68 bsb)
69 ucidef_set_interfaces_lan_wan "eth1" "eth0"
70 ucidef_add_switch "switch0" "1" "1"
71 ucidef_add_switch_ports "switch0" \
72 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
73 ucidef_set_interface_wlan
74 ;;
75
76 cpe510)
77 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
78 ucidef_add_switch "switch0" "1" "1"
79 ucidef_add_switch_ports "switch0" \
80 "0@eth0" "5:lan" "4:wan"
81 ;;
82
83 airgatewaypro)
84 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
85 ucidef_add_switch "switch0" "1" "1"
86 ucidef_add_switch_ports "switch0" \
87 "0@eth0" "4:lan" "5:wan"
88 ;;
89
90 db120 |\
91 rb-2011l | \
92 rb-2011uas |\
93 rb-2011uias |\
94 rb-2011uas-2hnd|\
95 rb-2011uias-2hnd)
96 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
97 ucidef_add_switch "switch0" "1" "1"
98
99 case "$board" in
100 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
101 ucidef_add_switch_ports "switch0" \
102 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
103 ;;
104 *)
105 ucidef_add_switch_ports "switch0" \
106 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
107 ;;
108 esac
109
110 ucidef_add_switch "switch1" "1" "1"
111 ucidef_add_switch_ports "switch1" \
112 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
113 ;;
114
115 dir-825-b1|\
116 tew-673gru)
117 ucidef_set_interfaces_lan_wan "eth0" "eth1"
118 ucidef_add_switch "switch0" "1" "1"
119 ucidef_add_switch_ports "switch0" \
120 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
121 ;;
122
123 f9k1115v2)
124 ucidef_set_interfaces_lan_wan "eth1" "eth0"
125 ucidef_add_switch "switch0" "1" "1"
126 ucidef_add_switch_ports "switch0" \
127 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
128 "0@eth0" "1:wan" # XXX: confirm cpu ports!
129 ;;
130
131 nbg460n_550n_550nh)
132 ucidef_set_interfaces_lan_wan "eth0" "eth1"
133 ucidef_add_switch "switch0" "1" "1"
134 ucidef_add_switch_ports "switch0" \
135 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
136 ;;
137
138 nbg6616 |\
139 nbg6716)
140 ucidef_set_interfaces_lan_wan "eth0" "eth1"
141 ucidef_add_switch "switch0" "1" "1"
142 ucidef_add_switch_ports "switch0" \
143 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
144 "5:wan" "6@eth1"
145 ;;
146
147 ap143 |\
148 rb-433 |\
149 rb-433u)
150 ucidef_set_interfaces_lan_wan "eth1" "eth0"
151 ucidef_add_switch "switch0" "1" "1"
152 ucidef_add_switch_ports "switch0" \
153 "1:lan" "2:lan" "5@eth1"
154 ;;
155
156 rb-435g)
157 ucidef_set_interfaces_lan_wan "eth1" "eth0"
158 ucidef_add_switch "switch0" "1" "1"
159 ucidef_add_switch_ports "switch0" \
160 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
161 ;;
162
163 rb-450)
164 ucidef_set_interfaces_lan_wan "eth1" "eth0"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_ports "switch0" \
167 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
168 ;;
169
170 rb-450g |\
171 routerstation-pro)
172 ucidef_set_interfaces_lan_wan "eth1" "eth0"
173 ucidef_add_switch "switch0" "1" "1"
174 ucidef_add_switch_ports "switch0" \
175 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
176 ;;
177
178 ap136 |\
179 rb-750gl |\
180 rb-751g |\
181 rb-951g-2hnd |\
182 wzr-hp-g450h)
183 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
184 ucidef_add_switch "switch0" "1" "1"
185 ucidef_add_switch_ports "switch0" \
186 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
187 ;;
188
189 rb-951ui-2hnd)
190 ucidef_set_interfaces_lan_wan "eth1" "eth0"
191 ;;
192
193 rb-493g)
194 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
195 ucidef_add_switch "switch0" "1" "1"
196 ucidef_add_switch_ports "switch0" \
197 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
198 ucidef_add_switch "switch1" "1" "1"
199 ucidef_add_switch_ports "switch1" \
200 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
201 ;;
202
203 wzr-hp-g300nh2 |\
204 pb92 |\
205 ap113)
206 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
207 ucidef_add_switch "switch0" "1" "1"
208 ucidef_add_switch_ports "switch0" \
209 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
210 ;;
211
212 el-m150)
213 ucidef_set_interfaces_lan_wan "eth1" "eth0"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_ports "switch0" \
216 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
217 ;;
218
219 tl-wdr4300|\
220 tl-wr1041n-v2)
221 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
222 ucidef_add_switch "switch0" "1" "1"
223 ucidef_add_switch_ports "switch0" \
224 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
225 ;;
226
227 tl-wr1043nd)
228 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
229 ucidef_add_switch "switch0" "1" "1"
230 ucidef_add_switch_ports "switch0" \
231 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
232 ;;
233
234 tl-wr2543n)
235 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
236 ucidef_add_switch "switch0" "1" "1"
237 ucidef_add_switch_ports "switch0" \
238 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
239 ;;
240
241 tl-wr841n-v1|\
242 tl-wr941nd)
243 ucidef_set_interface_raw "eth" "eth0"
244 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
245 ;;
246
247 dir-615-i1 |\
248 r6100 |\
249 smart-300 |\
250 tl-mr3420-v2 |\
251 tl-wr841n-v8 |\
252 tl-wr842n-v2 |\
253 tl-wr941nd-v5 |\
254 tl-wr941nd-v6 |\
255 tl-wdr6500-v2 |\
256 wnr2000-v3 |\
257 wnr2000-v4 |\
258 wnr2200 |\
259 wnr612-v2 |\
260 wnr1000-v2)
261 ucidef_set_interfaces_lan_wan "eth1" "eth0"
262 ucidef_add_switch "switch0" "1" "1"
263 ucidef_add_switch_ports "switch0" \
264 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
265 ;;
266
267 uap-pro)
268 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
269 ucidef_add_switch "switch0" "1" "1"
270 ucidef_add_switch_ports "switch0" \
271 "0@eth0" "1:lan" "2:wan"
272 ;;
273
274 nanostation-m-xw)
275 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
276 ucidef_add_switch "switch0" "1" "1"
277 ucidef_add_switch_ports "switch0" \
278 "0@eth0" "5:lan" "1:wan"
279 ;;
280
281 wrt160nl)
282 ucidef_set_interfaces_lan_wan "eth0" "eth1"
283 ucidef_add_switch "switch0" "1" "1"
284 ucidef_add_switch_ports "switch0" \
285 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
286 ;;
287
288 wzr-hp-g300nh)
289 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
290 ucidef_add_switch "switch0" "1" "1"
291 ucidef_add_switch_ports "switch0" \
292 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
293 ;;
294
295 dgl-5500-a1 |\
296 dir-825-c1)
297 local mac
298 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
299 ucidef_add_switch "switch0" "1" "1"
300 ucidef_add_switch_ports "switch0" \
301 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
302 mac=$(mtd_get_mac_ascii nvram "wan_mac")
303 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
304 ;;
305
306 mynet-n750)
307 local mac
308 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
309 ucidef_add_switch "switch0" "1" "1"
310 ucidef_add_switch_ports "switch0" \
311 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
312 mac=$(mtd_get_mac_ascii devdata "wanmac")
313 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
314 ;;
315
316 onion-omega)
317 ucidef_set_interface_lan "wlan0"
318 ;;
319
320 dhp-1565-a1 |\
321 dir-835-a1 |\
322 wndr3700v4 | \
323 wndr4300)
324 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
325 ucidef_add_switch "switch0" "1" "1"
326 ucidef_add_switch_ports "switch0" \
327 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
328 mac_lan=$(mtd_get_mac_binary caldata 0)
329 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
330 mac_wan=$(mtd_get_mac_binary caldata 6)
331 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
332 ;;
333
334 esr900)
335 local mac
336 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
337 ucidef_add_switch "switch0" "1" "1"
338 ucidef_add_switch_ports "switch0" \
339 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
340 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
341 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
342 ;;
343
344 dlan-hotspot |\
345 dlan-pro-500-wp)
346 ucidef_set_interface_lan "eth0 eth1"
347 ;;
348
349 dlan-pro-1200-ac)
350 ucidef_set_interface_lan "eth0"
351 ucidef_add_switch "switch0"
352 ucidef_add_switch_attr "switch0" "reset" "false"
353 ucidef_add_switch_ports "switch0" \
354 "0@eth0" "2:lan" "3:lan" "4:lan"
355 ;;
356
357 all0305 |\
358 antminer-s1 |\
359 antminer-s3 |\
360 aw-nr580 |\
361 bullet-m |\
362 cap4200ag |\
363 eap300v2 |\
364 eap7660d |\
365 el-mini |\
366 loco-m-xw |\
367 mr1750 |\
368 mr600 |\
369 mr600v2 |\
370 mr900 |\
371 mr900v2 |\
372 rb-411 |\
373 rb-911g-2hpnd |\
374 rb-911g-5hpacd |\
375 rb-911g-5hpnd |\
376 rb-912uag-2hpnd |\
377 rb-912uag-5hpnd |\
378 rb-sxt2n |\
379 rb-sxt5n |\
380 rocket-m-xw |\
381 tl-mr10u |\
382 tl-mr11u |\
383 tl-mr12u |\
384 tl-mr13u |\
385 tl-mr3020 |\
386 tl-mr3040 |\
387 tl-mr3040-v2 |\
388 tl-wa701nd-v2 |\
389 tl-wa7210n-v2 |\
390 tl-wa750re |\
391 tl-wa850re |\
392 tl-wa830re-v2 |\
393 tl-wa801nd-v2 |\
394 tl-wa901nd |\
395 tl-wa901nd-v2 |\
396 tl-wa901nd-v3 |\
397 tl-wr703n |\
398 tube2h |\
399 wndap360 |\
400 mynet-rext |\
401 wp543)
402 ucidef_set_interface_lan "eth0"
403 ;;
404
405 arduino-yun | \
406 dir-505-a1)
407 ucidef_set_interface_lan "eth1"
408 ;;
409
410 alfa-ap96 |\
411 alfa-nx |\
412 ap83 |\
413 gl-ar150 |\
414 gl-domino |\
415 gl-inet |\
416 jwap003 |\
417 pb42 |\
418 pb44 |\
419 routerstation|\
420 tl-wr710n |\
421 tl-wr720n-v3|\
422 wpe72)
423 ucidef_set_interfaces_lan_wan "eth1" "eth0"
424 ;;
425
426 gl-ar300)
427 ucidef_set_interfaces_lan_wan "eth1" "eth0"
428 ucidef_add_switch "switch0" "1" "1"
429 ucidef_add_switch_ports "switch0" \
430 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
431 ;;
432
433 wpj344)
434 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
435 ucidef_add_switch "switch0" "1" "1"
436 ucidef_add_switch_ports "switch0" \
437 "0@eth0" "3:lan" "2:wan"
438 ;;
439
440 wpj531)
441 ucidef_set_interfaces_lan_wan "eth0" "eth1"
442 ;;
443
444 wpj558)
445 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
446 ucidef_add_switch "switch0" "1" "1"
447 ucidef_add_switch_ports "switch0" \
448 "5:lan" "1:wan" "6@eth0"
449 ;;
450
451 ap121 |\
452 ap121-mini |\
453 ap96 |\
454 airrouter |\
455 dir-600-a1 |\
456 dir-615-c1 |\
457 dir-615-e1 |\
458 dir-615-e4 |\
459 hiwifi-hc6361 |\
460 ja76pf |\
461 mc-mac1200r|\
462 minibox-v1 |\
463 mynet-n600 |\
464 oolite |\
465 qihoo-c301 |\
466 rb-750 |\
467 rb-751 |\
468 tew-632brp |\
469 tew-712br |\
470 tew-732br |\
471 tl-mr3220 |\
472 tl-mr3220-v2 |\
473 tl-mr3420 |\
474 tl-wdr3320-v2 |\
475 tl-wdr3500 |\
476 tl-wr741nd |\
477 tl-wr741nd-v4 |\
478 tl-wr841n-v7 |\
479 tl-wr841n-v9 |\
480 whr-g301n |\
481 whr-hp-g300n |\
482 whr-hp-gn |\
483 wzr-hp-ag300h)
484 ucidef_set_interfaces_lan_wan "eth0" "eth1"
485 ucidef_add_switch "switch0" "1" "1"
486 ucidef_add_switch_ports "switch0" \
487 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
488 ;;
489
490 wzr-hp-g450h)
491 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
492 ucidef_add_switch "switch0" "1" "1"
493 ucidef_add_switch_ports "switch0" \
494 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
495 ;;
496
497 ew-dorin)
498 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
499 ucidef_add_switch "switch0" "1" "1"
500 ucidef_add_switch_ports "switch0" \
501 "0@eth0" "1:lan" "2:lan" "3:wan"
502 ;;
503
504 ew-dorin-router)
505 ucidef_set_interfaces_lan_wan "eth0" "eth1"
506 ucidef_add_switch "switch0" "1" "1"
507 ucidef_add_switch_ports "switch0" "0@eth0" "2:lan" "3:lan"
508 ;;
509
510 wndr3700)
511 ucidef_set_interfaces_lan_wan "eth0" "eth1"
512 ucidef_add_switch "switch0" "1" "1"
513 ucidef_add_switch_ports "switch0" \
514 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
515
516 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
517 ucidef_add_switch_attr "switch0" "blinkrate" 2
518
519 # Port 1 controls the GREEN configuration of LEDs for
520 # the switch and the section does not correspond to a real
521 # switch port.
522 #
523 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
524 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
525 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
526 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
527 # 14: Link (master); 15: separate register
528 ucidef_add_switch_port_attr "switch0" 1 led 6
529
530 # Port 2 controls the ORANGE configuration of LEDs for
531 # the switch and the section does not correspond to a real
532 # switch port.
533 #
534 # See the key above for switch port 1 for the meaning of the
535 # 'led' setting below.
536 ucidef_add_switch_port_attr "switch0" 2 led 9
537
538 # Port 5 controls the configuration of the WAN LED and the
539 # section does not correspond to a real switch port.
540 #
541 # To toggle the use of green or orange LEDs for the WAN port,
542 # see the LED setting for wndr3700:green:wan in /etc/config/system.
543 #
544 # See the key above for switch port 1 for the meaning of the
545 # 'led' setting below.
546 ucidef_add_switch_port_attr "switch0" 5 led 2
547 ;;
548
549 *)
550 ucidef_set_interfaces_lan_wan "eth0" "eth1"
551 ;;
552 esac
553
554 board_config_flush
555
556 exit 0