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