ar71xx: Add TP-Link TL-WA901ND v4 support to Chaos Calmer 15.05.1
[15.05/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 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_vlan "switch0" "1" "0t 2 3 4 5"
30         ucidef_add_switch_vlan "switch0" "2" "0t 1"
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_vlan "switch0" "1" "0t 1 2 3 4"
38         ucidef_add_switch_vlan "switch0" "2" "0t 5"
39         ;;
40
41 ap136-010)
42         ucidef_set_interfaces_lan_wan "eth0" "eth1"
43         ucidef_add_switch "switch0" "1" "1"
44         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
45         ucidef_add_switch_vlan "switch0" "2" "5 6"
46         ;;
47
48 ap136-020 |\
49 ap135-020 |\
50 tl-wr1043nd-v2 |\
51 wzr-450hp2)
52         ucidef_set_interfaces_lan_wan "eth1" "eth0"
53         ucidef_add_switch "switch0" "1" "1"
54         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
55         ucidef_add_switch_vlan "switch0" "2" "5 6"
56         ;;
57
58 archer-c5 |\
59 archer-c7 |\
60 tl-wdr4900-v2)
61         ucidef_set_interfaces_lan_wan "eth1" "eth0"
62         ucidef_add_switch "switch0" "1" "1"
63         ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
64         ucidef_add_switch_vlan "switch0" "2" "1 6"
65         ;;
66
67 bsb)
68         ucidef_set_interfaces_lan_wan "eth1" "eth0"
69         ucidef_add_switch "switch0" "1" "1"
70         ucidef_add_switch_vlan "switch0" "1" "0 1 3"
71         ucidef_set_interface_wlan
72         ;;
73
74 cpe510)
75         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
76         ucidef_add_switch "switch0" "1" "1"
77         ucidef_add_switch_vlan "switch0" "1" "0t 5"
78         ucidef_add_switch_vlan "switch0" "2" "0t 4"
79         ;;
80
81 db120 |\
82 rb-2011l | \
83 rb-2011uas |\
84 rb-2011uias |\
85 rb-2011uas-2hnd|\
86 rb-2011uias-2hnd)
87         ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
88         ucidef_add_switch "switch0" "1" "1"
89         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
90         ucidef_add_switch_vlan "switch0" "2" "0t 1"
91         ucidef_add_switch "switch1" "1" "1"
92         ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
93
94         case "$board" in
95         rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
96                 ucidef_set_interface_raw "sfp" "eth0.3"
97                 ucidef_add_switch_vlan "switch0" "3" "0t 6"
98                 ;;
99         esac
100         ;;
101
102 dir-825-b1|\
103 tew-673gru)
104         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
105         ucidef_add_switch "switch0" "1" "1"
106         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
107         ;;
108
109 f9k1115v2)
110         ucidef_set_interfaces_lan_wan "eth1" "eth0"
111         ucidef_add_switch "switch0" "1" "1"
112         ucidef_add_switch_vlan "switch0" "1" "2 3 4 5 6"
113         ucidef_add_switch_vlan "switch0" "2" "0 1"
114         ;;
115
116 nbg460n_550n_550nh)
117         ucidef_set_interfaces_lan_wan "eth0" "eth1"
118         ucidef_add_switch "switch0" "1" "1"
119         ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
120         ;;
121
122 nbg6716)
123         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
124         ucidef_add_switch "switch0" "1" "1"
125         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
126         ucidef_add_switch_vlan "switch0" "2" "5 6"
127         ;;
128
129 rb-433 |\
130 rb-433u)
131         ucidef_set_interfaces_lan_wan "eth1" "eth0"
132         ucidef_add_switch "switch0" "1" "1"
133         ucidef_add_switch_vlan "switch0" "1" "1 2 5"
134         ;;
135
136 rb-435g)
137         ucidef_set_interfaces_lan_wan "eth1" "eth0"
138         ucidef_add_switch "switch0" "1" "1"
139         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
140         ;;
141
142 rb-450)
143         ucidef_set_interfaces_lan_wan "eth1" "eth0"
144         ucidef_add_switch "switch0" "1" "1"
145         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
146         ;;
147
148 rb-450g |\
149 routerstation-pro)
150         ucidef_set_interfaces_lan_wan "eth1" "eth0"
151         ucidef_add_switch "switch0" "1" "1"
152         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
153         ;;
154
155 ap136 |\
156 rb-750gl |\
157 rb-751g |\
158 rb-951g-2hnd |\
159 wzr-hp-g450h)
160         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
161         ucidef_add_switch "switch0" "1" "1"
162         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
163         ucidef_add_switch_vlan "switch0" "2" "0t 1"
164         ;;
165
166 rb-951ui-2hnd)
167         ucidef_set_interfaces_lan_wan "eth1" "eth0"
168         ;;
169
170 rb-493g)
171         ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
172         ucidef_add_switch "switch0" "1" "1"
173         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
174         ucidef_add_switch "switch1" "1" "1"
175         ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
176         ucidef_add_switch_vlan "switch1" "2" "0t 5"
177         ;;
178
179 wzr-hp-g300nh2 |\
180 pb92 |\
181 ap113)
182         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
183         ucidef_add_switch "switch0" "1" "1"
184         ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
185         ucidef_add_switch_vlan "switch0" "2" "0t 2"
186         ;;
187
188 el-m150)
189         ucidef_set_interfaces_lan_wan "eth1" "eth0"
190         ucidef_add_switch "switch0" "1" "1"
191         ucidef_add_switch_vlan "switch0" "1" "0 1 3"
192         ;;
193
194 tl-wdr4300|\
195 tl-wr1041n-v2)
196         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
197         ucidef_add_switch "switch0" "1" "1"
198         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
199         ucidef_add_switch_vlan "switch0" "2" "0t 1"
200         ;;
201
202 tl-wr1043nd)
203         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
204         ucidef_add_switch "switch0" "1" "1"
205         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
206         ucidef_add_switch_vlan "switch0" "2" "0 5t"
207         ;;
208
209 tl-wr2543n)
210         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
211         ucidef_add_switch "switch0" "1" "1"
212         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
213         ucidef_add_switch_vlan "switch0" "2" "0 9t"
214         ;;
215
216 tl-wr841n-v1|\
217 tl-wr941nd)
218         ucidef_set_interface_raw "eth" "eth0"
219         ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
220         ;;
221
222 r6100 |\
223 smart-300 |\
224 dir-615-i1 |\
225 tl-mr3420-v2 |\
226 tl-wr841n-v8 |\
227 tl-wr842n-v2 |\
228 tl-wr941nd-v5 |\
229 tl-wr941nd-v6 |\
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 alfa-ap120c |\
326 all0305 |\
327 antminer-s1 |\
328 antminer-s3 |\
329 aw-nr580 |\
330 bullet-m |\
331 cap4200ag |\
332 eap300v2 |\
333 eap7660d |\
334 el-mini |\
335 loco-m-xw |\
336 mr600 |\
337 mr600v2 |\
338 mr900 |\
339 mr900v2 |\
340 rb-411 |\
341 rb-911g-2hpnd |\
342 rb-911g-5hpacd |\
343 rb-911g-5hpnd |\
344 rb-912uag-2hpnd |\
345 rb-912uag-5hpnd |\
346 rb-sxt2n |\
347 rb-sxt5n |\
348 rocket-m-xw |\
349 tl-mr10u |\
350 tl-mr11u |\
351 tl-mr12u |\
352 tl-mr13u |\
353 tl-mr3020 |\
354 tl-mr3040 |\
355 tl-mr3040-v2 |\
356 tl-wa701nd-v2 |\
357 tl-wa7210n-v2 |\
358 tl-wa750re |\
359 tl-wa850re |\
360 tl-wa830re-v2 |\
361 tl-wa801nd-v2 |\
362 tl-wa901nd |\
363 tl-wa901nd-v2 |\
364 tl-wa901nd-v3 |\
365 tl-wa901nd-v4 |\
366 tl-wr703n |\
367 tube2h |\
368 wndap360 |\
369 mynet-rext |\
370 wp543)
371         ucidef_set_interface_lan "eth0"
372         ;;
373
374 dir-505-a1)
375         ucidef_set_interface_lan "eth1"
376         ;;
377
378 alfa-ap96 |\
379 alfa-nx |\
380 ap83 |\
381 gl-inet |\
382 jwap003 |\
383 pb42 |\
384 pb44 |\
385 routerstation|\
386 tl-wr710n |\
387 tl-wr720n-v3|\
388 wpe72)
389         ucidef_set_interfaces_lan_wan "eth1" "eth0"
390         ;;
391
392 wpj344)
393         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
394         ucidef_add_switch "switch0" "1" "1"
395         ucidef_add_switch_vlan "switch0" "1" "0t 3"
396         ucidef_add_switch_vlan "switch0" "2" "0t 2"
397         ;;
398
399 wpj531)
400         ucidef_set_interfaces_lan_wan "eth0" "eth1"
401         ;;
402
403 wpj558)
404         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
405         ucidef_add_switch "switch0" "1" "1"
406         ucidef_add_switch_vlan "switch0" "1" "5 6t"
407         ucidef_add_switch_vlan "switch0" "2" "1 6t"
408         ;;
409
410 ap121 |\
411 ap121-mini |\
412 ap96 |\
413 airrouter |\
414 dir-600-a1 |\
415 dir-615-c1 |\
416 dir-615-e1 |\
417 dir-615-e4 |\
418 hiwifi-hc6361 |\
419 ja76pf |\
420 mc-mac1200r|\
421 minibox-v1 |\
422 mynet-n600 |\
423 oolite |\
424 qihoo-c301 |\
425 rb-750 |\
426 rb-751 |\
427 tew-632brp |\
428 tew-712br |\
429 tew-732br |\
430 tl-mr3220 |\
431 tl-mr3220-v2 |\
432 tl-mr3420 |\
433 tl-wdr3500 |\
434 tl-wr741nd |\
435 tl-wr741nd-v4 |\
436 tl-wr841n-v7 |\
437 tl-wr841n-v9 |\
438 whr-g301n |\
439 whr-hp-g300n |\
440 whr-hp-gn |\
441 wzr-hp-ag300h)
442         ucidef_set_interfaces_lan_wan "eth0" "eth1"
443         ucidef_add_switch "switch0" "1" "1"
444         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
445         ;;
446
447 wzr-hp-g450h)
448         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
449         ucidef_add_switch "switch0" "1" "1"
450         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
451         ucidef_add_switch_vlan "switch0" "2" "0t 1"
452         ;;
453
454 ew-dorin)
455         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
456         ucidef_add_switch "switch0" "1" "1"
457         ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
458         ucidef_add_switch_vlan "switch0" "2" "0t 3"
459         ;;
460
461 ew-dorin-router)
462         ucidef_set_interfaces_lan_wan "eth0" "eth1"
463         ucidef_add_switch "switch0" "1" "1"
464         ucidef_add_switch_vlan "switch0" "1" "0 2 3"
465         ;;
466
467 wndr3700)
468         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
469         ucidef_add_switch "switch0" "1" "1"
470         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
471         # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
472         uci set network.@switch[-1].blinkrate='2'
473
474         ucidef_add_switch_port "switch0" "1"
475         # Port 1 controls the GREEN configuration of LEDs for
476         # the switch and the section does not correspond to a real
477         # switch port.
478         #
479         # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
480         # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
481         # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
482         # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
483         # 14: Link (master); 15: separate register
484         uci set network.@switch_port[-1].led='6'
485
486         ucidef_add_switch_port "switch0" "2"
487         # Port 2 controls the ORANGE configuration of LEDs for
488         # the switch and the section does not correspond to a real
489         # switch port.
490         #
491         # See the key above for switch port 1 for the meaning of the
492         # 'led' setting below.
493         uci set network.@switch_port[-1].led='9'
494
495         ucidef_add_switch_port "switch0" "5"
496         # Port 5 controls the configuration of the WAN LED and the
497         # section does not correspond to a real switch port.
498         #
499         # To toggle the use of green or orange LEDs for the WAN port,
500         # see the LED setting for wndr3700:green:wan in /etc/config/system.
501         #
502         # See the key above for switch port 1 for the meaning of the
503         # 'led' setting below.
504         uci set network.@switch_port[-1].led='2'
505         ;;
506
507 *)
508         ucidef_set_interfaces_lan_wan "eth0" "eth1"
509         ;;
510 esac
511
512 uci commit network
513
514 exit 0