3 # Copyright (C) 2011-2015 OpenWrt.org
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
12 board=$(ar71xx_board_name)
22 ucidef_set_interface_lan "eth0 eth1"
28 ucidef_add_switch "switch0" \
29 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
34 ucidef_add_switch "switch0" \
35 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
39 ucidef_add_switch "switch0" \
40 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
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"
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"
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"
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
76 ucidef_add_switch "switch0" \
77 "0@eth0" "5:lan" "4:wan"
81 ucidef_add_switch "switch0" \
82 "0@eth0" "4:lan" "5:wan"
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"
97 ucidef_add_switch "switch0" \
98 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
102 ucidef_add_switch "switch1" \
103 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
108 ucidef_set_interfaces_lan_wan "eth0" "eth1"
109 ucidef_add_switch "switch0" \
110 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
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!
121 ucidef_set_interfaces_lan_wan "eth0" "eth1"
122 ucidef_add_switch "switch0" \
123 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
128 ucidef_set_interfaces_lan_wan "eth0" "eth1"
129 ucidef_add_switch "switch0" \
130 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
137 ucidef_set_interfaces_lan_wan "eth1" "eth0"
138 ucidef_add_switch "switch0" \
139 "1:lan" "2:lan" "5@eth1"
143 ucidef_set_interfaces_lan_wan "eth1" "eth0"
144 ucidef_add_switch "switch0" \
145 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
149 ucidef_set_interfaces_lan_wan "eth1" "eth0"
150 ucidef_add_switch "switch0" \
151 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
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"
166 ucidef_add_switch "switch0" \
167 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
171 ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
185 ucidef_add_switch "switch0" \
186 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
190 ucidef_set_interfaces_lan_wan "eth1" "eth0"
191 ucidef_add_switch "switch0" \
192 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
196 ucidef_set_interface_wan "eth0" "dhcp"
197 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
202 ucidef_add_switch "switch0" \
203 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
207 ucidef_add_switch "switch0" \
208 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
212 ucidef_add_switch "switch0" \
213 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
218 ucidef_set_interface_raw "eth" "eth0"
219 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
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!
243 ucidef_add_switch "switch0" \
244 "0@eth0" "1:lan" "2:wan"
248 ucidef_add_switch "switch0" \
249 "0@eth0" "5:lan" "1:wan"
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"
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"
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"
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"
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"
288 ucidef_set_interface_lan "wlan0"
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"
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"
313 ucidef_set_interface_lan "eth0 eth1"
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"
374 ucidef_set_interface_lan "eth0"
378 ucidef_set_interface_lan "eth0" "dhcp"
384 ucidef_set_interface_lan "eth1"
400 ucidef_set_interfaces_lan_wan "eth1" "eth0"
404 ucidef_set_interfaces_lan_wan "eth1" "eth0"
405 ucidef_add_switch "switch0" \
406 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
410 ucidef_add_switch "switch0" \
411 "0@eth0" "1:lan" "2:wan"
415 ucidef_add_switch "switch0" \
416 "0@eth0" "3:lan" "2:wan"
420 ucidef_set_interfaces_lan_wan "eth0" "eth1"
424 ucidef_add_switch "switch0" \
425 "5:lan" "1:wan" "6@eth0"
461 ucidef_set_interfaces_lan_wan "eth0" "eth1"
462 ucidef_add_switch "switch0" \
463 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
467 ucidef_add_switch "switch0" \
468 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
472 ucidef_add_switch "switch0" \
473 "0@eth0" "1:lan" "2:lan" "3:wan"
477 ucidef_set_interfaces_lan_wan "eth0" "eth1"
478 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
482 ucidef_set_interfaces_lan_wan "eth0" "eth1"
483 ucidef_add_switch "switch0" \
484 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
486 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
487 ucidef_add_switch_attr "switch0" "blinkrate" 2
489 # Port 1 controls the GREEN configuration of LEDs for
490 # the switch and the section does not correspond to a real
493 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
494 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
495 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
496 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
497 # 14: Link (master); 15: separate register
498 ucidef_add_switch_port_attr "switch0" 1 led 6
500 # Port 2 controls the ORANGE configuration of LEDs for
501 # the switch and the section does not correspond to a real
504 # See the key above for switch port 1 for the meaning of the
505 # 'led' setting below.
506 ucidef_add_switch_port_attr "switch0" 2 led 9
508 # Port 5 controls the configuration of the WAN LED and the
509 # section does not correspond to a real switch port.
511 # To toggle the use of green or orange LEDs for the WAN port,
512 # see the LED setting for wndr3700:green:wan in /etc/config/system.
514 # See the key above for switch port 1 for the meaning of the
515 # 'led' setting below.
516 ucidef_add_switch_port_attr "switch0" 5 led 2
520 ucidef_set_interfaces_lan_wan "eth0" "eth1"