ar71xx: add user space support for the TL-WA801ND v2
[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 ap136-010)
34         ucidef_set_interfaces_lan_wan "eth0" "eth1"
35         ucidef_add_switch "switch0" "1" "1"
36         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
37         ucidef_add_switch_vlan "switch0" "2" "5 6"
38         ;;
39
40 ap136-020 |\
41 ap135-020 |\
42 tl-wr1043nd-v2)
43         ucidef_set_interfaces_lan_wan "eth1" "eth0"
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 archer-c7)
50         ucidef_set_interfaces_lan_wan "eth1" "eth0"
51         ucidef_add_switch "switch0" "1" "1"
52         ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
53         ucidef_add_switch_vlan "switch0" "2" "1 6"
54         ;;
55
56 db120 |\
57 rb-2011l | \
58 rb-2011uas |\
59 rb-2011uas-2hnd)
60         ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
61         ucidef_add_switch "switch0" "1" "1"
62         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
63         ucidef_add_switch_vlan "switch0" "2" "0t 1"
64         ucidef_add_switch "switch1" "1" "1"
65         ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
66
67         case "$board" in
68         rb-2011uas*)
69                 ucidef_set_interface_raw "sfp" "eth0.3"
70                 ucidef_add_switch_vlan "switch0" "3" "0t 6"
71                 ;;
72         esac
73         ;;
74
75 dir-825-b1|\
76 tew-673gru)
77         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
78         ucidef_add_switch "switch0" "1" "1"
79         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
80         ;;
81
82 nbg460n_550n_550nh)
83         ucidef_set_interfaces_lan_wan "eth0" "eth1"
84         ucidef_add_switch "switch0" "1" "1"
85         ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
86         ;;
87
88 rb-433 |\
89 rb-433u)
90         ucidef_set_interfaces_lan_wan "eth1" "eth0"
91         ucidef_add_switch "switch0" "1" "1"
92         ucidef_add_switch_vlan "switch0" "1" "1 2 5"
93         ;;
94
95 rb-435g)
96         ucidef_set_interfaces_lan_wan "eth1" "eth0"
97         ucidef_add_switch "switch0" "1" "1"
98         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
99         ;;
100
101 rb-450)
102         ucidef_set_interfaces_lan_wan "eth1" "eth0"
103         ucidef_add_switch "switch0" "1" "1"
104         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
105         ;;
106
107 rb-450g |\
108 routerstation-pro)
109         ucidef_set_interfaces_lan_wan "eth1" "eth0"
110         ucidef_add_switch "switch0" "1" "1"
111         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
112         ;;
113
114 ap136 |\
115 rb-750gl |\
116 rb-751g |\
117 rb-951g-2hnd |\
118 wzr-hp-g450h)
119         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
120         ucidef_add_switch "switch0" "1" "1"
121         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
122         ucidef_add_switch_vlan "switch0" "2" "0t 1"
123         ;;
124
125 rb-493g)
126         ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
127         ucidef_add_switch "switch0" "1" "1"
128         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
129         ucidef_add_switch "switch1" "1" "1"
130         ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
131         ucidef_add_switch_vlan "switch1" "2" "0t 5"
132         ;;
133
134 wzr-hp-g300nh2 |\
135 pb92 |\
136 ap113)
137         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138         ucidef_add_switch "switch0" "1" "1"
139         ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
140         ucidef_add_switch_vlan "switch0" "2" "0t 2"
141         ;;
142
143 tl-wdr4300|\
144 tl-wr1041n-v2)
145         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
146         ucidef_add_switch "switch0" "1" "1"
147         ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
148         ucidef_add_switch_vlan "switch0" "2" "0t 1"
149         ;;
150
151 tl-wr1043nd)
152         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153         ucidef_add_switch "switch0" "1" "1"
154         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
155         ucidef_add_switch_vlan "switch0" "2" "0 5t"
156         ;;
157
158 tl-wr2543n)
159         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
160         ucidef_add_switch "switch0" "1" "1"
161         ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
162         ucidef_add_switch_vlan "switch0" "2" "0 9t"
163         ;;
164
165 tl-wr841n-v1|\
166 tl-wr941nd)
167         ucidef_set_interface_raw "eth" "eth0"
168         ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
169         ;;
170
171 tl-mr3420-v2 |\
172 tl-wr841n-v8 |\
173 tl-wr842n-v2 |\
174 wnr2000-v3 |\
175 wnr2200 |\
176 wnr612-v2)
177         ucidef_set_interfaces_lan_wan "eth1" "eth0"
178         ucidef_add_switch "switch0" "1" "1"
179         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
180         ;;
181
182 uap-pro)
183         ucidef_set_interface_lan "eth0"
184         ucidef_add_switch "switch0" "1" "1"
185         ucidef_add_switch_vlan "switch0" "1" "0 1 2"
186         ;;
187
188 wrt160nl)
189         ucidef_set_interfaces_lan_wan "eth0" "eth1"
190         ucidef_add_switch "switch0" "1" "1"
191         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
192         ;;
193
194 wzr-hp-g300nh)
195         ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
196         ucidef_add_switch "switch0" "1" "1"
197         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
198         ;;
199
200 dir-825-c1)
201         local mac
202         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
203         ucidef_add_switch "switch0" "1" "1"
204         ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
205         ucidef_add_switch_vlan "switch0" "2" "0t 5"
206         mac=$(mtd_get_mac_ascii nvram "^wan_mac")
207         [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
208         ;;
209
210 dir-835-a1 |\
211 wndr4300)
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 1 2 3 4"
215         ucidef_add_switch_vlan "switch0" "2" "0t 5"
216         mac_lan=$(mtd_get_mac_binary caldata 0)
217         [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
218         mac_wan=$(mtd_get_mac_binary caldata 6)
219         [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
220         ;;
221
222 all0305 |\
223 aw-nr580 |\
224 bullet-m |\
225 cap4200ag |\
226 eap7660d |\
227 mr600 |\
228 mr600v2 |\
229 rb-411 |\
230 tl-mr10u |\
231 tl-mr11u |\
232 tl-mr13u |\
233 tl-mr3020 |\
234 tl-mr3040 |\
235 tl-mr3040-v2 |\
236 tl-wa750re |\
237 tl-wa850re |\
238 tl-wa801nd-v2 |\
239 tl-wa901nd |\
240 tl-wa901nd-v2 |\
241 tl-wr703n |\
242 wndap360 |\
243 mynet-rext |\
244 wp543)
245         ucidef_set_interface_lan "eth0"
246         ;;
247
248 dir-505-a1)
249         ucidef_set_interface_lan "eth1"
250         ;;
251
252 alfa-ap96 |\
253 alfa-nx |\
254 ap83 |\
255 jwap003 |\
256 pb42 |\
257 pb44 |\
258 routerstation|\
259 tl-wr710n |\
260 tl-wr720n-v3|\
261 wpe72)
262         ucidef_set_interfaces_lan_wan "eth1" "eth0"
263         ;;
264
265 ap121 |\
266 ap121-mini |\
267 ap96 |\
268 airrouter |\
269 dir-600-a1 |\
270 dir-615-c1 |\
271 dir-615-e4 |\
272 ja76pf |\
273 mynet-n600 |\
274 rb-750 |\
275 rb-751 |\
276 tew-632brp |\
277 tew-712br |\
278 tl-mr3220 |\
279 tl-mr3220-v2 |\
280 tl-mr3420 |\
281 tl-wdr3500 |\
282 tl-wr741nd |\
283 tl-wr741nd-v4 |\
284 tl-wr841n-v7 |\
285 whr-g301n |\
286 whr-hp-g300n |\
287 whr-hp-gn |\
288 wzr-hp-ag300h)
289         ucidef_set_interfaces_lan_wan "eth0" "eth1"
290         ucidef_add_switch "switch0" "1" "1"
291         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
292         ;;
293
294 wzr-hp-g450h)
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 2 3 4 5"
298         ucidef_add_switch_vlan "switch0" "2" "0t 1"
299         ;;
300
301 ew-dorin)
302         ucidef_set_interface_lan "eth0"
303         ucidef_add_switch "switch0" "1" "1"
304         ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
305         ;;
306
307 ew-dorin-router)
308         ucidef_set_interfaces_lan_wan "eth0" "eth1"
309         ucidef_add_switch "switch0" "1" "1"
310         ucidef_add_switch_vlan "switch0" "1" "0 2 3"
311         ;;
312
313 *)
314         ucidef_set_interfaces_lan_wan "eth0" "eth1"
315         ;;
316 esac
317
318 uci commit network
319
320 exit 0