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