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