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