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"
238 ucidef_set_interfaces_lan_wan "eth1" "eth0"
239 ucidef_add_switch "switch0" \
240 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
244 ucidef_add_switch "switch0" \
245 "0@eth0" "1:lan" "2:wan"
249 ucidef_add_switch "switch0" \
250 "0@eth0" "5:lan" "1:wan"
254 ucidef_set_interfaces_lan_wan "eth0" "eth1"
255 ucidef_add_switch "switch0" \
256 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
260 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
261 ucidef_add_switch "switch0" \
262 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
266 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
267 ucidef_add_switch "switch0" \
268 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
274 ucidef_add_switch "switch0" \
275 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
276 mac=$(mtd_get_mac_ascii nvram "wan_mac")
277 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
282 ucidef_add_switch "switch0" \
283 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
284 mac=$(mtd_get_mac_ascii devdata "wanmac")
285 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
289 ucidef_set_interface_lan "wlan0"
296 ucidef_add_switch "switch0" \
297 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
298 mac_lan=$(mtd_get_mac_binary caldata 0)
299 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
300 mac_wan=$(mtd_get_mac_binary caldata 6)
301 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
306 ucidef_add_switch "switch0" \
307 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
308 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
309 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
314 ucidef_set_interface_lan "eth0 eth1"
318 ucidef_set_interface_lan "eth0"
319 ucidef_add_switch "switch0" \
320 "0@eth0" "2:lan" "3:lan" "4:lan"
321 ucidef_add_switch_attr "switch0" "enable" "false"
375 ucidef_set_interface_lan "eth0"
379 ucidef_set_interface_lan "eth0" "dhcp"
385 ucidef_set_interface_lan "eth1"
402 ucidef_set_interfaces_lan_wan "eth1" "eth0"
406 ucidef_set_interfaces_lan_wan "eth1" "eth0"
407 ucidef_add_switch "switch0" \
408 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
412 ucidef_add_switch "switch0" \
413 "0@eth0" "1:lan" "2:wan"
417 ucidef_add_switch "switch0" \
418 "0@eth0" "3:lan" "2:wan"
422 ucidef_set_interfaces_lan_wan "eth0" "eth1"
426 ucidef_add_switch "switch0" \
427 "5:lan" "1:wan" "6@eth0"
463 ucidef_set_interfaces_lan_wan "eth0" "eth1"
464 ucidef_add_switch "switch0" \
465 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
469 ucidef_add_switch "switch0" \
470 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
474 ucidef_add_switch "switch0" \
475 "0@eth0" "1:lan" "2:lan" "3:wan"
479 ucidef_set_interfaces_lan_wan "eth0" "eth1"
480 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
484 ucidef_set_interfaces_lan_wan "eth0" "eth1"
485 ucidef_add_switch "switch0" \
486 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
488 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
489 ucidef_add_switch_attr "switch0" "blinkrate" 2
491 # Port 1 controls the GREEN configuration of LEDs for
492 # the switch and the section does not correspond to a real
495 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
496 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
497 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
498 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
499 # 14: Link (master); 15: separate register
500 ucidef_add_switch_port_attr "switch0" 1 led 6
502 # Port 2 controls the ORANGE configuration of LEDs for
503 # the switch and the section does not correspond to a real
506 # See the key above for switch port 1 for the meaning of the
507 # 'led' setting below.
508 ucidef_add_switch_port_attr "switch0" 2 led 9
510 # Port 5 controls the configuration of the WAN LED and the
511 # section does not correspond to a real switch port.
513 # To toggle the use of green or orange LEDs for the WAN port,
514 # see the LED setting for wndr3700:green:wan in /etc/config/system.
516 # See the key above for switch port 1 for the meaning of the
517 # 'led' setting below.
518 ucidef_add_switch_port_attr "switch0" 5 led 2
522 ucidef_set_interfaces_lan_wan "eth0" "eth1"