3 # Copyright (C) 2011-2015 OpenWrt.org
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults-new.sh
12 board=$(ar71xx_board_name)
21 ucidef_set_interface_lan "eth0 eth1"
26 ucidef_add_switch "switch0" \
27 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
32 ucidef_add_switch "switch0" \
33 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
38 ucidef_set_interfaces_lan_wan "eth0" "eth1"
39 ucidef_add_switch "switch0" \
40 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
47 ucidef_set_interfaces_lan_wan "eth1" "eth0"
48 ucidef_add_switch "switch0" \
49 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
55 ucidef_set_interfaces_lan_wan "eth1" "eth0"
56 ucidef_add_switch "switch0" \
57 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
61 ucidef_set_interfaces_lan_wan "eth1" "eth0"
62 ucidef_add_switch "switch0" \
63 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
64 ucidef_set_interface_wlan
68 ucidef_add_switch "switch0" \
69 "0@eth0" "5:lan" "4:wan"
73 ucidef_add_switch "switch0" \
74 "0@eth0" "4:lan" "5:wan"
84 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
85 ucidef_add_switch "switch0" \
86 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
89 ucidef_add_switch "switch0" \
90 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
94 ucidef_add_switch "switch1" \
95 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
100 ucidef_set_interfaces_lan_wan "eth0" "eth1"
101 ucidef_add_switch "switch0" \
102 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
106 ucidef_set_interfaces_lan_wan "eth1" "eth0"
107 ucidef_add_switch "switch0" \
108 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
109 "0@eth0" "1:wan" # XXX: confirm cpu ports!
113 ucidef_set_interfaces_lan_wan "eth0" "eth1"
114 ucidef_add_switch "switch0" \
115 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
120 ucidef_set_interfaces_lan_wan "eth0" "eth1"
121 ucidef_add_switch "switch0" \
122 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
129 ucidef_set_interfaces_lan_wan "eth1" "eth0"
130 ucidef_add_switch "switch0" \
131 "1:lan" "2:lan" "5@eth1"
135 ucidef_set_interfaces_lan_wan "eth1" "eth0"
136 ucidef_add_switch "switch0" \
137 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
141 ucidef_set_interfaces_lan_wan "eth1" "eth0"
142 ucidef_add_switch "switch0" \
143 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
148 ucidef_set_interfaces_lan_wan "eth1" "eth0"
149 ucidef_add_switch "switch0" \
150 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
158 ucidef_add_switch "switch0" \
159 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
163 ucidef_set_interfaces_lan_wan "eth1" "eth0"
167 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
168 ucidef_add_switch "switch0" \
169 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
170 ucidef_add_switch "switch1" \
171 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
177 ucidef_add_switch "switch0" \
178 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
182 ucidef_set_interfaces_lan_wan "eth1" "eth0"
183 ucidef_add_switch "switch0" \
184 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
189 ucidef_add_switch "switch0" \
190 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
194 ucidef_add_switch "switch0" \
195 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
199 ucidef_add_switch "switch0" \
200 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
205 ucidef_set_interface_raw "eth" "eth0"
206 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
223 ucidef_set_interfaces_lan_wan "eth1" "eth0"
224 ucidef_add_switch "switch0" \
225 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
229 ucidef_add_switch "switch0" \
230 "0@eth0" "1:lan" "2:wan"
234 ucidef_add_switch "switch0" \
235 "0@eth0" "5:lan" "1:wan"
239 ucidef_set_interfaces_lan_wan "eth0" "eth1"
240 ucidef_add_switch "switch0" \
241 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
245 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
246 ucidef_add_switch "switch0" \
247 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
253 ucidef_add_switch "switch0" \
254 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
255 mac=$(mtd_get_mac_ascii nvram "wan_mac")
256 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
261 ucidef_add_switch "switch0" \
262 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
263 mac=$(mtd_get_mac_ascii devdata "wanmac")
264 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
268 ucidef_set_interface_lan "wlan0"
275 ucidef_add_switch "switch0" \
276 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
277 mac_lan=$(mtd_get_mac_binary caldata 0)
278 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
279 mac_wan=$(mtd_get_mac_binary caldata 6)
280 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
285 ucidef_add_switch "switch0" \
286 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
287 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
288 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
293 ucidef_set_interface_lan "eth0 eth1"
297 ucidef_set_interface_lan "eth0"
298 ucidef_add_switch "switch0"
299 ucidef_add_switch_attr "switch0" "reset" "false"
300 ucidef_add_switch_ports "switch0" \
301 "0@eth0" "2:lan" "3:lan" "4:lan"
349 ucidef_set_interface_lan "eth0"
354 ucidef_set_interface_lan "eth1"
370 ucidef_set_interfaces_lan_wan "eth1" "eth0"
374 ucidef_set_interfaces_lan_wan "eth1" "eth0"
375 ucidef_add_switch "switch0" \
376 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
380 ucidef_add_switch "switch0" \
381 "0@eth0" "3:lan" "2:wan"
385 ucidef_set_interfaces_lan_wan "eth0" "eth1"
389 ucidef_add_switch "switch0" \
390 "5:lan" "1:wan" "6@eth0"
426 ucidef_set_interfaces_lan_wan "eth0" "eth1"
427 ucidef_add_switch "switch0" \
428 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
432 ucidef_add_switch "switch0" \
433 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
437 ucidef_add_switch "switch0" \
438 "0@eth0" "1:lan" "2:lan" "3:wan"
442 ucidef_set_interfaces_lan_wan "eth0" "eth1"
443 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
447 ucidef_set_interfaces_lan_wan "eth0" "eth1"
448 ucidef_add_switch "switch0" \
449 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
451 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
452 ucidef_add_switch_attr "switch0" "blinkrate" 2
454 # Port 1 controls the GREEN configuration of LEDs for
455 # the switch and the section does not correspond to a real
458 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
459 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
460 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
461 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
462 # 14: Link (master); 15: separate register
463 ucidef_add_switch_port_attr "switch0" 1 led 6
465 # Port 2 controls the ORANGE configuration of LEDs for
466 # the switch and the section does not correspond to a real
469 # See the key above for switch port 1 for the meaning of the
470 # 'led' setting below.
471 ucidef_add_switch_port_attr "switch0" 2 led 9
473 # Port 5 controls the configuration of the WAN LED and the
474 # section does not correspond to a real switch port.
476 # To toggle the use of green or orange LEDs for the WAN port,
477 # see the LED setting for wndr3700:green:wan in /etc/config/system.
479 # See the key above for switch port 1 for the meaning of the
480 # 'led' setting below.
481 ucidef_add_switch_port_attr "switch0" 5 led 2
485 ucidef_set_interfaces_lan_wan "eth0" "eth1"