ar71xx: fix switch port map for the Sitecom WLR-8100
[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 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 tl-wr842n-v2 |\
173 wnr2000-v3 |\
174 wnr2200 |\
175 wnr612-v2)
176 ucidef_set_interfaces_lan_wan "eth1" "eth0"
177 ucidef_add_switch "switch0" "1" "1"
178 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
179 ;;
180
181 uap-pro)
182 ucidef_set_interface_lan "eth0"
183 ucidef_add_switch "switch0" "1" "1"
184 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
185 ;;
186
187 wrt160nl)
188 ucidef_set_interfaces_lan_wan "eth0" "eth1"
189 ucidef_add_switch "switch0" "1" "1"
190 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
191 ;;
192
193 wzr-hp-g300nh)
194 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
195 ucidef_add_switch "switch0" "1" "1"
196 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
197 ;;
198
199 dir-825-c1)
200 local mac
201 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
202 ucidef_add_switch "switch0" "1" "1"
203 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
204 ucidef_add_switch_vlan "switch0" "2" "0t 5"
205 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
206 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
207 ;;
208
209 dir-835-a1 |\
210 wndr4300)
211 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
212 ucidef_add_switch "switch0" "1" "1"
213 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
214 ucidef_add_switch_vlan "switch0" "2" "0t 5"
215 mac_lan=$(mtd_get_mac_binary caldata 0)
216 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
217 mac_wan=$(mtd_get_mac_binary caldata 6)
218 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
219 ;;
220
221 all0305 |\
222 aw-nr580 |\
223 bullet-m |\
224 cap4200ag |\
225 eap7660d |\
226 mr600 |\
227 mr600v2 |\
228 rb-411 |\
229 tl-mr10u |\
230 tl-mr11u |\
231 tl-mr13u |\
232 tl-mr3020 |\
233 tl-mr3040 |\
234 tl-mr3040-v2 |\
235 tl-wa750re |\
236 tl-wa850re |\
237 tl-wa901nd |\
238 tl-wa901nd-v2 |\
239 tl-wr703n |\
240 wndap360 |\
241 mynet-rext |\
242 wp543)
243 ucidef_set_interface_lan "eth0"
244 ;;
245
246 dir-505-a1)
247 ucidef_set_interface_lan "eth1"
248 ;;
249
250 alfa-ap96 |\
251 alfa-nx |\
252 ap83 |\
253 jwap003 |\
254 pb42 |\
255 pb44 |\
256 routerstation|\
257 tl-wr710n |\
258 tl-wr720n-v3|\
259 wpe72)
260 ucidef_set_interfaces_lan_wan "eth1" "eth0"
261 ;;
262
263 ap121 |\
264 ap121-mini |\
265 ap96 |\
266 airrouter |\
267 dir-600-a1 |\
268 dir-615-c1 |\
269 dir-615-e4 |\
270 ja76pf |\
271 mynet-n600 |\
272 rb-750 |\
273 rb-751 |\
274 tew-632brp |\
275 tew-712br |\
276 tl-mr3220 |\
277 tl-mr3220-v2 |\
278 tl-mr3420 |\
279 tl-wdr3500 |\
280 tl-wr741nd |\
281 tl-wr741nd-v4 |\
282 tl-wr841n-v7 |\
283 whr-g301n |\
284 whr-hp-g300n |\
285 whr-hp-gn |\
286 wzr-hp-ag300h)
287 ucidef_set_interfaces_lan_wan "eth0" "eth1"
288 ucidef_add_switch "switch0" "1" "1"
289 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
290 ;;
291
292 wzr-hp-g450h)
293 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
294 ucidef_add_switch "switch0" "1" "1"
295 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
296 ucidef_add_switch_vlan "switch0" "2" "0t 1"
297 ;;
298
299 ew-dorin)
300 ucidef_set_interface_lan "eth0"
301 ucidef_add_switch "switch0" "1" "1"
302 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
303 ;;
304
305 ew-dorin-router)
306 ucidef_set_interfaces_lan_wan "eth0" "eth1"
307 ucidef_add_switch "switch0" "1" "1"
308 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
309 ;;
310
311 *)
312 ucidef_set_interfaces_lan_wan "eth0" "eth1"
313 ;;
314 esac
315
316 uci commit network
317
318 exit 0