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"
27 ucidef_add_switch "switch0" \
28 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
33 ucidef_add_switch "switch0" \
34 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
38 ucidef_add_switch "switch0" \
39 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
44 ucidef_set_interfaces_lan_wan "eth0" "eth1"
45 ucidef_add_switch "switch0" \
46 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
54 ucidef_set_interfaces_lan_wan "eth1" "eth0"
55 ucidef_add_switch "switch0" \
56 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
62 ucidef_set_interfaces_lan_wan "eth1" "eth0"
63 ucidef_add_switch "switch0" \
64 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
68 ucidef_set_interfaces_lan_wan "eth1" "eth0"
69 ucidef_add_switch "switch0" \
70 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
71 ucidef_set_interface_wlan
75 ucidef_add_switch "switch0" \
76 "0@eth0" "5:lan" "4:wan"
80 ucidef_add_switch "switch0" \
81 "0@eth0" "4:lan" "5:wan"
91 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
92 ucidef_add_switch "switch0" \
93 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
96 ucidef_add_switch "switch0" \
97 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
101 ucidef_add_switch "switch1" \
102 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
107 ucidef_set_interfaces_lan_wan "eth0" "eth1"
108 ucidef_add_switch "switch0" \
109 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
113 ucidef_set_interfaces_lan_wan "eth1" "eth0"
114 ucidef_add_switch "switch0" \
115 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
116 "0@eth0" "1:wan" # XXX: confirm cpu ports!
120 ucidef_set_interfaces_lan_wan "eth0" "eth1"
121 ucidef_add_switch "switch0" \
122 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
127 ucidef_set_interfaces_lan_wan "eth0" "eth1"
128 ucidef_add_switch "switch0" \
129 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
136 ucidef_set_interfaces_lan_wan "eth1" "eth0"
137 ucidef_add_switch "switch0" \
138 "1:lan" "2:lan" "5@eth1"
142 ucidef_set_interfaces_lan_wan "eth1" "eth0"
143 ucidef_add_switch "switch0" \
144 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
148 ucidef_set_interfaces_lan_wan "eth1" "eth0"
149 ucidef_add_switch "switch0" \
150 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
155 ucidef_set_interfaces_lan_wan "eth1" "eth0"
156 ucidef_add_switch "switch0" \
157 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
165 ucidef_add_switch "switch0" \
166 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
170 ucidef_set_interfaces_lan_wan "eth1" "eth0"
174 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
175 ucidef_add_switch "switch0" \
176 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
177 ucidef_add_switch "switch1" \
178 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
184 ucidef_add_switch "switch0" \
185 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
189 ucidef_set_interfaces_lan_wan "eth1" "eth0"
190 ucidef_add_switch "switch0" \
191 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
196 ucidef_add_switch "switch0" \
197 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
201 ucidef_add_switch "switch0" \
202 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
206 ucidef_add_switch "switch0" \
207 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
212 ucidef_set_interface_raw "eth" "eth0"
213 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
230 ucidef_set_interfaces_lan_wan "eth1" "eth0"
231 ucidef_add_switch "switch0" \
232 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
236 ucidef_add_switch "switch0" \
237 "0@eth0" "1:lan" "2:wan"
241 ucidef_add_switch "switch0" \
242 "0@eth0" "5:lan" "1:wan"
246 ucidef_set_interfaces_lan_wan "eth0" "eth1"
247 ucidef_add_switch "switch0" \
248 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
252 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
253 ucidef_add_switch "switch0" \
254 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
258 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
259 ucidef_add_switch "switch0" \
260 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
266 ucidef_add_switch "switch0" \
267 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
268 mac=$(mtd_get_mac_ascii nvram "wan_mac")
269 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
274 ucidef_add_switch "switch0" \
275 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
276 mac=$(mtd_get_mac_ascii devdata "wanmac")
277 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
281 ucidef_set_interface_lan "wlan0"
288 ucidef_add_switch "switch0" \
289 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
290 mac_lan=$(mtd_get_mac_binary caldata 0)
291 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
292 mac_wan=$(mtd_get_mac_binary caldata 6)
293 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
298 ucidef_add_switch "switch0" \
299 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
300 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
301 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
306 ucidef_set_interface_lan "eth0 eth1"
310 ucidef_set_interface_lan "eth0"
311 ucidef_add_switch "switch0"
312 ucidef_add_switch_attr "switch0" "reset" "false"
313 ucidef_add_switch_ports "switch0" \
314 "0@eth0" "2:lan" "3:lan" "4:lan"
363 ucidef_set_interface_lan "eth0"
367 ucidef_set_interface_lan "eth0" "dhcp"
372 ucidef_set_interface_lan "eth1"
388 ucidef_set_interfaces_lan_wan "eth1" "eth0"
392 ucidef_set_interfaces_lan_wan "eth1" "eth0"
393 ucidef_add_switch "switch0" \
394 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
398 ucidef_add_switch "switch0" \
399 "0@eth0" "3:lan" "2:wan"
403 ucidef_set_interfaces_lan_wan "eth0" "eth1"
407 ucidef_add_switch "switch0" \
408 "5:lan" "1:wan" "6@eth0"
444 ucidef_set_interfaces_lan_wan "eth0" "eth1"
445 ucidef_add_switch "switch0" \
446 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
450 ucidef_add_switch "switch0" \
451 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
455 ucidef_add_switch "switch0" \
456 "0@eth0" "1:lan" "2:lan" "3:wan"
460 ucidef_set_interfaces_lan_wan "eth0" "eth1"
461 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
465 ucidef_set_interfaces_lan_wan "eth0" "eth1"
466 ucidef_add_switch "switch0" \
467 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
469 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
470 ucidef_add_switch_attr "switch0" "blinkrate" 2
472 # Port 1 controls the GREEN configuration of LEDs for
473 # the switch and the section does not correspond to a real
476 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
477 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
478 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
479 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
480 # 14: Link (master); 15: separate register
481 ucidef_add_switch_port_attr "switch0" 1 led 6
483 # Port 2 controls the ORANGE configuration of LEDs for
484 # the switch and the section does not correspond to a real
487 # See the key above for switch port 1 for the meaning of the
488 # 'led' setting below.
489 ucidef_add_switch_port_attr "switch0" 2 led 9
491 # Port 5 controls the configuration of the WAN LED and the
492 # section does not correspond to a real switch port.
494 # To toggle the use of green or orange LEDs for the WAN port,
495 # see the LED setting for wndr3700:green:wan in /etc/config/system.
497 # See the key above for switch port 1 for the meaning of the
498 # 'led' setting below.
499 ucidef_add_switch_port_attr "switch0" 5 led 2
503 ucidef_set_interfaces_lan_wan "eth0" "eth1"