c6a20149b5047a293a6be4165f07e4c77ebc7b1f
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
8 . /lib/ar71xx.sh
9
10 board_config_update
11
12 board=$(ar71xx_board_name)
13
14
15 case "$board" in
16 all0315n |\
17 all0258n |\
18 dr344 |\
19 ja76pf2|\
20 rocket-m-ti |\
21 ubnt-unifi-outdoor)
22 ucidef_set_interface_lan "eth0 eth1"
23 ;;
24
25 ap132 |\
26 ap152 |\
27 wlr8100)
28 ucidef_add_switch "switch0" \
29 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
30 ;;
31
32 esr1750 |\
33 epg5000)
34 ucidef_add_switch "switch0" \
35 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
36 ;;
37
38 cr5000)
39 ucidef_add_switch "switch0" \
40 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
41 ;;
42
43 ap136-010 |\
44 ap147-010)
45 ucidef_set_interfaces_lan_wan "eth0" "eth1"
46 ucidef_add_switch "switch0" \
47 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
48 ;;
49
50 ap136-020 |\
51 ap135-020 |\
52 tew-823dru |\
53 tl-wr1043nd-v2 |\
54 wzr-450hp2)
55 ucidef_set_interfaces_lan_wan "eth1" "eth0"
56 ucidef_add_switch "switch0" \
57 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
58 ;;
59
60 archer-c5 |\
61 archer-c7 |\
62 tl-wdr4900-v2)
63 ucidef_set_interfaces_lan_wan "eth1" "eth0"
64 ucidef_add_switch "switch0" \
65 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
66 ;;
67
68 bsb)
69 ucidef_set_interfaces_lan_wan "eth1" "eth0"
70 ucidef_add_switch "switch0" \
71 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
72 ucidef_set_interface_wlan
73 ;;
74
75 cpe510)
76 ucidef_add_switch "switch0" \
77 "0@eth0" "5:lan" "4:wan"
78 ;;
79
80 airgatewaypro)
81 ucidef_add_switch "switch0" \
82 "0@eth0" "4:lan" "5:wan"
83 ;;
84
85 db120 |\
86 rb-2011l | \
87 rb-2011uas |\
88 rb-2011uias |\
89 rb-2011uas-2hnd|\
90 rb-2011uias-2hnd)
91 case "$board" in
92 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
93 ucidef_add_switch "switch0" \
94 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
95 ;;
96 *)
97 ucidef_add_switch "switch0" \
98 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
99 ;;
100 esac
101
102 ucidef_add_switch "switch1" \
103 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
104 ;;
105
106 dir-825-b1|\
107 tew-673gru)
108 ucidef_set_interfaces_lan_wan "eth0" "eth1"
109 ucidef_add_switch "switch0" \
110 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
111 ;;
112
113 f9k1115v2)
114 ucidef_set_interfaces_lan_wan "eth1" "eth0"
115 ucidef_add_switch "switch0" \
116 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
117 "0@eth0" "1:wan" # XXX: confirm cpu ports!
118 ;;
119
120 nbg460n_550n_550nh)
121 ucidef_set_interfaces_lan_wan "eth0" "eth1"
122 ucidef_add_switch "switch0" \
123 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
124 ;;
125
126 nbg6616 |\
127 nbg6716)
128 ucidef_set_interfaces_lan_wan "eth0" "eth1"
129 ucidef_add_switch "switch0" \
130 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
131 "5:wan" "6@eth1"
132 ;;
133
134 ap143 |\
135 rb-433 |\
136 rb-433u)
137 ucidef_set_interfaces_lan_wan "eth1" "eth0"
138 ucidef_add_switch "switch0" \
139 "1:lan" "2:lan" "5@eth1"
140 ;;
141
142 rb-435g)
143 ucidef_set_interfaces_lan_wan "eth1" "eth0"
144 ucidef_add_switch "switch0" \
145 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
146 ;;
147
148 rb-450)
149 ucidef_set_interfaces_lan_wan "eth1" "eth0"
150 ucidef_add_switch "switch0" \
151 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
152 ;;
153
154 rb-450g |\
155 routerstation-pro)
156 ucidef_set_interfaces_lan_wan "eth1" "eth0"
157 ucidef_add_switch "switch0" \
158 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
159 ;;
160
161 ap136 |\
162 rb-750gl |\
163 rb-751g |\
164 rb-951g-2hnd |\
165 wzr-hp-g450h)
166 ucidef_add_switch "switch0" \
167 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
168 ;;
169
170 rb-951ui-2hnd)
171 ucidef_set_interfaces_lan_wan "eth1" "eth0"
172 ;;
173
174 rb-493g)
175 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
176 ucidef_add_switch "switch0" \
177 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
178 ucidef_add_switch "switch1" \
179 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
180 ;;
181
182 wzr-hp-g300nh2 |\
183 pb92 |\
184 ap113)
185 ucidef_add_switch "switch0" \
186 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
187 ;;
188
189 el-m150)
190 ucidef_set_interfaces_lan_wan "eth1" "eth0"
191 ucidef_add_switch "switch0" \
192 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
193 ;;
194
195 tellstick-znet-lite)
196 ucidef_set_interface_wan "eth0" "dhcp"
197 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
198 ;;
199
200 tl-wdr4300|\
201 tl-wr1041n-v2)
202 ucidef_add_switch "switch0" \
203 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
204 ;;
205
206 tl-wr1043nd)
207 ucidef_add_switch "switch0" \
208 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
209 ;;
210
211 tl-wr2543n)
212 ucidef_add_switch "switch0" \
213 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
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 dir-615-i1 |\
223 r6100 |\
224 smart-300 |\
225 tl-mr3420-v2 |\
226 tl-wr841n-v8 |\
227 tl-wr842n-v2 |\
228 tl-wr941nd-v5 |\
229 tl-wr941nd-v6 |\
230 tl-wdr6500-v2 |\
231 wnr2000-v3 |\
232 wnr2000-v4 |\
233 wnr2200 |\
234 wnr612-v2 |\
235 wnr1000-v2 |\
236 wpn824n)
237 ucidef_set_interfaces_lan_wan "eth1" "eth0"
238 ucidef_add_switch "switch0" \
239 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
240 ;;
241
242 uap-pro)
243 ucidef_add_switch "switch0" \
244 "0@eth0" "1:lan" "2:wan"
245 ;;
246
247 nanostation-m-xw)
248 ucidef_add_switch "switch0" \
249 "0@eth0" "5:lan" "1:wan"
250 ;;
251
252 wrt160nl)
253 ucidef_set_interfaces_lan_wan "eth0" "eth1"
254 ucidef_add_switch "switch0" \
255 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
256 ;;
257
258 wzr-hp-g300nh)
259 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
260 ucidef_add_switch "switch0" \
261 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
262 ;;
263
264 cr3000)
265 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
266 ucidef_add_switch "switch0" \
267 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
268 ;;
269
270 dgl-5500-a1 |\
271 dir-825-c1)
272 local mac
273 ucidef_add_switch "switch0" \
274 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
275 mac=$(mtd_get_mac_ascii nvram "wan_mac")
276 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
277 ;;
278
279 mynet-n750)
280 local mac
281 ucidef_add_switch "switch0" \
282 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
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_add_switch "switch0" \
296 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
297 mac_lan=$(mtd_get_mac_binary caldata 0)
298 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
299 mac_wan=$(mtd_get_mac_binary caldata 6)
300 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
301 ;;
302
303 esr900)
304 local mac
305 ucidef_add_switch "switch0" \
306 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
307 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
308 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
309 ;;
310
311 dlan-hotspot |\
312 dlan-pro-500-wp)
313 ucidef_set_interface_lan "eth0 eth1"
314 ;;
315
316 dlan-pro-1200-ac)
317 ucidef_set_interface_lan "eth0"
318 ucidef_add_switch "switch0" \
319 "0@eth0" "2:lan" "3:lan" "4:lan"
320 ucidef_add_switch_attr "switch0" "enable" "false"
321 ;;
322
323 alfa-ap120c |\
324 all0305 |\
325 antminer-s1 |\
326 antminer-s3 |\
327 antrouter-r1 |\
328 aw-nr580 |\
329 bullet-m |\
330 c-55 |\
331 cap4200ag |\
332 eap300v2 |\
333 eap7660d |\
334 el-mini |\
335 loco-m-xw |\
336 mr1750 |\
337 mr18 |\
338 mr600 |\
339 mr600v2 |\
340 mr900 |\
341 mr900v2 |\
342 rb-411 |\
343 rb-911g-2hpnd |\
344 rb-911g-5hpacd |\
345 rb-911g-5hpnd |\
346 rb-912uag-2hpnd |\
347 rb-912uag-5hpnd |\
348 rb-sxt2n |\
349 rb-sxt5n |\
350 rocket-m-xw |\
351 tl-mr10u |\
352 tl-mr11u |\
353 tl-mr12u |\
354 tl-mr13u |\
355 tl-mr3020 |\
356 tl-mr3040 |\
357 tl-mr3040-v2 |\
358 tl-wa701nd-v2 |\
359 tl-wa7210n-v2 |\
360 tl-wa750re |\
361 tl-wa850re |\
362 tl-wa830re-v2 |\
363 tl-wa801nd-v2 |\
364 tl-wa901nd |\
365 tl-wa901nd-v2 |\
366 tl-wa901nd-v3 |\
367 tl-wr703n |\
368 tube2h |\
369 unifiac |\
370 wndap360 |\
371 mynet-rext |\
372 wp543)
373 ucidef_set_interface_lan "eth0"
374 ;;
375
376 cap324)
377 ucidef_set_interface_lan "eth0" "dhcp"
378 ;;
379
380 arduino-yun |\
381 tl-wa801nd-v3 |\
382 dir-505-a1)
383 ucidef_set_interface_lan "eth1"
384 ;;
385
386 alfa-ap96 |\
387 alfa-nx |\
388 ap83 |\
389 gl-ar150 |\
390 gl-domino |\
391 gl-inet |\
392 jwap003 |\
393 pb42 |\
394 pb44 |\
395 routerstation|\
396 tl-wr710n |\
397 tl-wr720n-v3|\
398 wpe72)
399 ucidef_set_interfaces_lan_wan "eth1" "eth0"
400 ;;
401
402 gl-ar300)
403 ucidef_set_interfaces_lan_wan "eth1" "eth0"
404 ucidef_add_switch "switch0" \
405 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
406 ;;
407
408 wpj342)
409 ucidef_add_switch "switch0" \
410 "0@eth0" "1:lan" "2:wan"
411 ;;
412
413 wpj344)
414 ucidef_add_switch "switch0" \
415 "0@eth0" "3:lan" "2:wan"
416 ;;
417
418 wpj531)
419 ucidef_set_interfaces_lan_wan "eth0" "eth1"
420 ;;
421
422 wpj558)
423 ucidef_add_switch "switch0" \
424 "5:lan" "1:wan" "6@eth0"
425 ;;
426
427 ap121 |\
428 ap121-mini |\
429 ap96 |\
430 airrouter |\
431 dir-600-a1 |\
432 dir-615-c1 |\
433 dir-615-e1 |\
434 dir-615-e4 |\
435 hiwifi-hc6361 |\
436 ja76pf |\
437 mc-mac1200r|\
438 minibox-v1 |\
439 mynet-n600 |\
440 oolite |\
441 qihoo-c301 |\
442 rb-750 |\
443 rb-751 |\
444 tew-632brp |\
445 tew-712br |\
446 tew-732br |\
447 tl-mr3220 |\
448 tl-mr3220-v2 |\
449 tl-mr3420 |\
450 tl-wdr3320-v2 |\
451 tl-wdr3500 |\
452 tl-wr741nd |\
453 tl-wr741nd-v4 |\
454 tl-wr841n-v7 |\
455 tl-wr841n-v9 |\
456 whr-g301n |\
457 whr-hp-g300n |\
458 whr-hp-gn |\
459 wzr-hp-ag300h)
460 ucidef_set_interfaces_lan_wan "eth0" "eth1"
461 ucidef_add_switch "switch0" \
462 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
463 ;;
464
465 wzr-hp-g450h)
466 ucidef_add_switch "switch0" \
467 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
468 ;;
469
470 ew-dorin)
471 ucidef_add_switch "switch0" \
472 "0@eth0" "1:lan" "2:lan" "3:wan"
473 ;;
474
475 ew-dorin-router)
476 ucidef_set_interfaces_lan_wan "eth0" "eth1"
477 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
478 ;;
479
480 wndr3700)
481 ucidef_set_interfaces_lan_wan "eth0" "eth1"
482 ucidef_add_switch "switch0" \
483 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
484
485 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
486 ucidef_add_switch_attr "switch0" "blinkrate" 2
487
488 # Port 1 controls the GREEN configuration of LEDs for
489 # the switch and the section does not correspond to a real
490 # switch port.
491 #
492 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
493 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
494 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
495 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
496 # 14: Link (master); 15: separate register
497 ucidef_add_switch_port_attr "switch0" 1 led 6
498
499 # Port 2 controls the ORANGE configuration of LEDs for
500 # the switch and the section does not correspond to a real
501 # switch port.
502 #
503 # See the key above for switch port 1 for the meaning of the
504 # 'led' setting below.
505 ucidef_add_switch_port_attr "switch0" 2 led 9
506
507 # Port 5 controls the configuration of the WAN LED and the
508 # section does not correspond to a real switch port.
509 #
510 # To toggle the use of green or orange LEDs for the WAN port,
511 # see the LED setting for wndr3700:green:wan in /etc/config/system.
512 #
513 # See the key above for switch port 1 for the meaning of the
514 # 'led' setting below.
515 ucidef_add_switch_port_attr "switch0" 5 led 2
516 ;;
517
518 *)
519 ucidef_set_interfaces_lan_wan "eth0" "eth1"
520 ;;
521 esac
522
523 board_config_flush
524
525 exit 0