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"
39 ucidef_set_interfaces_lan_wan "eth0" "eth1"
40 ucidef_add_switch "switch0" \
41 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
49 ucidef_set_interfaces_lan_wan "eth1" "eth0"
50 ucidef_add_switch "switch0" \
51 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
57 ucidef_set_interfaces_lan_wan "eth1" "eth0"
58 ucidef_add_switch "switch0" \
59 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
63 ucidef_set_interfaces_lan_wan "eth1" "eth0"
64 ucidef_add_switch "switch0" \
65 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
66 ucidef_set_interface_wlan
70 ucidef_add_switch "switch0" \
71 "0@eth0" "5:lan" "4:wan"
75 ucidef_add_switch "switch0" \
76 "0@eth0" "4:lan" "5:wan"
86 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
87 ucidef_add_switch "switch0" \
88 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
91 ucidef_add_switch "switch0" \
92 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
96 ucidef_add_switch "switch1" \
97 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
102 ucidef_set_interfaces_lan_wan "eth0" "eth1"
103 ucidef_add_switch "switch0" \
104 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
108 ucidef_set_interfaces_lan_wan "eth1" "eth0"
109 ucidef_add_switch "switch0" \
110 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
111 "0@eth0" "1:wan" # XXX: confirm cpu ports!
115 ucidef_set_interfaces_lan_wan "eth0" "eth1"
116 ucidef_add_switch "switch0" \
117 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
122 ucidef_set_interfaces_lan_wan "eth0" "eth1"
123 ucidef_add_switch "switch0" \
124 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
131 ucidef_set_interfaces_lan_wan "eth1" "eth0"
132 ucidef_add_switch "switch0" \
133 "1:lan" "2:lan" "5@eth1"
137 ucidef_set_interfaces_lan_wan "eth1" "eth0"
138 ucidef_add_switch "switch0" \
139 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
143 ucidef_set_interfaces_lan_wan "eth1" "eth0"
144 ucidef_add_switch "switch0" \
145 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
150 ucidef_set_interfaces_lan_wan "eth1" "eth0"
151 ucidef_add_switch "switch0" \
152 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
160 ucidef_add_switch "switch0" \
161 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
165 ucidef_set_interfaces_lan_wan "eth1" "eth0"
169 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
170 ucidef_add_switch "switch0" \
171 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
172 ucidef_add_switch "switch1" \
173 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
179 ucidef_add_switch "switch0" \
180 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
184 ucidef_set_interfaces_lan_wan "eth1" "eth0"
185 ucidef_add_switch "switch0" \
186 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
191 ucidef_add_switch "switch0" \
192 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
196 ucidef_add_switch "switch0" \
197 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
201 ucidef_add_switch "switch0" \
202 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
207 ucidef_set_interface_raw "eth" "eth0"
208 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
225 ucidef_set_interfaces_lan_wan "eth1" "eth0"
226 ucidef_add_switch "switch0" \
227 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
231 ucidef_add_switch "switch0" \
232 "0@eth0" "1:lan" "2:wan"
236 ucidef_add_switch "switch0" \
237 "0@eth0" "5:lan" "1:wan"
241 ucidef_set_interfaces_lan_wan "eth0" "eth1"
242 ucidef_add_switch "switch0" \
243 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
247 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
248 ucidef_add_switch "switch0" \
249 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
255 ucidef_add_switch "switch0" \
256 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
257 mac=$(mtd_get_mac_ascii nvram "wan_mac")
258 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
263 ucidef_add_switch "switch0" \
264 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
265 mac=$(mtd_get_mac_ascii devdata "wanmac")
266 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
270 ucidef_set_interface_lan "wlan0"
277 ucidef_add_switch "switch0" \
278 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
279 mac_lan=$(mtd_get_mac_binary caldata 0)
280 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
281 mac_wan=$(mtd_get_mac_binary caldata 6)
282 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
287 ucidef_add_switch "switch0" \
288 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
289 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
290 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
295 ucidef_set_interface_lan "eth0 eth1"
299 ucidef_set_interface_lan "eth0"
300 ucidef_add_switch "switch0"
301 ucidef_add_switch_attr "switch0" "reset" "false"
302 ucidef_add_switch_ports "switch0" \
303 "0@eth0" "2:lan" "3:lan" "4:lan"
352 ucidef_set_interface_lan "eth0"
357 ucidef_set_interface_lan "eth1"
373 ucidef_set_interfaces_lan_wan "eth1" "eth0"
377 ucidef_set_interfaces_lan_wan "eth1" "eth0"
378 ucidef_add_switch "switch0" \
379 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
383 ucidef_add_switch "switch0" \
384 "0@eth0" "3:lan" "2:wan"
388 ucidef_set_interfaces_lan_wan "eth0" "eth1"
392 ucidef_add_switch "switch0" \
393 "5:lan" "1:wan" "6@eth0"
429 ucidef_set_interfaces_lan_wan "eth0" "eth1"
430 ucidef_add_switch "switch0" \
431 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
435 ucidef_add_switch "switch0" \
436 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
440 ucidef_add_switch "switch0" \
441 "0@eth0" "1:lan" "2:lan" "3:wan"
445 ucidef_set_interfaces_lan_wan "eth0" "eth1"
446 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
450 ucidef_set_interfaces_lan_wan "eth0" "eth1"
451 ucidef_add_switch "switch0" \
452 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
454 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
455 ucidef_add_switch_attr "switch0" "blinkrate" 2
457 # Port 1 controls the GREEN configuration of LEDs for
458 # the switch and the section does not correspond to a real
461 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
462 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
463 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
464 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
465 # 14: Link (master); 15: separate register
466 ucidef_add_switch_port_attr "switch0" 1 led 6
468 # Port 2 controls the ORANGE configuration of LEDs for
469 # the switch and the section does not correspond to a real
472 # See the key above for switch port 1 for the meaning of the
473 # 'led' setting below.
474 ucidef_add_switch_port_attr "switch0" 2 led 9
476 # Port 5 controls the configuration of the WAN LED and the
477 # section does not correspond to a real switch port.
479 # To toggle the use of green or orange LEDs for the WAN port,
480 # see the LED setting for wndr3700:green:wan in /etc/config/system.
482 # See the key above for switch port 1 for the meaning of the
483 # 'led' setting below.
484 ucidef_add_switch_port_attr "switch0" 5 led 2
488 ucidef_set_interfaces_lan_wan "eth0" "eth1"