ar71xx: add userspace support for WD My Net N750
[openwrt/svn-archive/archive.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 mynet-n750)
211 local mac
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=$(mtd_get_mac_ascii devdata "wanmac")
217 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
218 ;;
219
220 dir-835-a1 |\
221 wndr4300)
222 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
223 ucidef_add_switch "switch0" "1" "1"
224 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
225 ucidef_add_switch_vlan "switch0" "2" "0t 5"
226 mac_lan=$(mtd_get_mac_binary caldata 0)
227 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
228 mac_wan=$(mtd_get_mac_binary caldata 6)
229 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
230 ;;
231
232 all0305 |\
233 aw-nr580 |\
234 bullet-m |\
235 cap4200ag |\
236 eap7660d |\
237 mr600 |\
238 mr600v2 |\
239 rb-411 |\
240 tl-mr10u |\
241 tl-mr11u |\
242 tl-mr13u |\
243 tl-mr3020 |\
244 tl-mr3040 |\
245 tl-mr3040-v2 |\
246 tl-wa750re |\
247 tl-wa850re |\
248 tl-wa801nd-v2 |\
249 tl-wa901nd |\
250 tl-wa901nd-v2 |\
251 tl-wa901nd-v3 |\
252 tl-wr703n |\
253 wndap360 |\
254 mynet-rext |\
255 wp543)
256 ucidef_set_interface_lan "eth0"
257 ;;
258
259 dir-505-a1)
260 ucidef_set_interface_lan "eth1"
261 ;;
262
263 alfa-ap96 |\
264 alfa-nx |\
265 ap83 |\
266 jwap003 |\
267 pb42 |\
268 pb44 |\
269 routerstation|\
270 tl-wr710n |\
271 tl-wr720n-v3|\
272 wpe72)
273 ucidef_set_interfaces_lan_wan "eth1" "eth0"
274 ;;
275
276 ap121 |\
277 ap121-mini |\
278 ap96 |\
279 airrouter |\
280 dir-600-a1 |\
281 dir-615-c1 |\
282 dir-615-e4 |\
283 ja76pf |\
284 mynet-n600 |\
285 rb-750 |\
286 rb-751 |\
287 tew-632brp |\
288 tew-712br |\
289 tl-mr3220 |\
290 tl-mr3220-v2 |\
291 tl-mr3420 |\
292 tl-wdr3500 |\
293 tl-wr741nd |\
294 tl-wr741nd-v4 |\
295 tl-wr841n-v7 |\
296 whr-g301n |\
297 whr-hp-g300n |\
298 whr-hp-gn |\
299 wzr-hp-ag300h)
300 ucidef_set_interfaces_lan_wan "eth0" "eth1"
301 ucidef_add_switch "switch0" "1" "1"
302 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
303 ;;
304
305 wzr-hp-g450h)
306 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
307 ucidef_add_switch "switch0" "1" "1"
308 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
309 ucidef_add_switch_vlan "switch0" "2" "0t 1"
310 ;;
311
312 ew-dorin)
313 ucidef_set_interface_lan "eth0"
314 ucidef_add_switch "switch0" "1" "1"
315 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
316 ;;
317
318 ew-dorin-router)
319 ucidef_set_interfaces_lan_wan "eth0" "eth1"
320 ucidef_add_switch "switch0" "1" "1"
321 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
322 ;;
323
324 *)
325 ucidef_set_interfaces_lan_wan "eth0" "eth1"
326 ;;
327 esac
328
329 uci commit network
330
331 exit 0