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
77 ucidef_add_switch "switch0" \
78 "0@eth0" "5:lan" "4:wan"
82 ucidef_add_switch "switch0" \
83 "0@eth0" "4:lan" "5:wan"
93 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
94 ucidef_add_switch "switch0" \
95 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
98 ucidef_add_switch "switch0" \
99 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
103 ucidef_add_switch "switch1" \
104 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
109 ucidef_set_interfaces_lan_wan "eth0" "eth1"
110 ucidef_add_switch "switch0" \
111 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
115 ucidef_set_interfaces_lan_wan "eth1" "eth0"
116 ucidef_add_switch "switch0" \
117 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
118 "0@eth0" "1:wan" # XXX: confirm cpu ports!
122 ucidef_set_interfaces_lan_wan "eth0" "eth1"
123 ucidef_add_switch "switch0" \
124 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
129 ucidef_set_interfaces_lan_wan "eth0" "eth1"
130 ucidef_add_switch "switch0" \
131 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
138 ucidef_set_interfaces_lan_wan "eth1" "eth0"
139 ucidef_add_switch "switch0" \
140 "1:lan" "2:lan" "5@eth1"
144 ucidef_set_interfaces_lan_wan "eth1" "eth0"
145 ucidef_add_switch "switch0" \
146 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
150 ucidef_set_interfaces_lan_wan "eth1" "eth0"
151 ucidef_add_switch "switch0" \
152 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
157 ucidef_set_interfaces_lan_wan "eth1" "eth0"
158 ucidef_add_switch "switch0" \
159 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
167 ucidef_add_switch "switch0" \
168 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
172 ucidef_set_interfaces_lan_wan "eth1" "eth0"
176 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
177 ucidef_add_switch "switch0" \
178 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
179 ucidef_add_switch "switch1" \
180 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
186 ucidef_add_switch "switch0" \
187 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
191 ucidef_set_interfaces_lan_wan "eth1" "eth0"
192 ucidef_add_switch "switch0" \
193 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
197 ucidef_set_interface_wan "eth0" "dhcp"
198 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
203 ucidef_add_switch "switch0" \
204 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
208 ucidef_add_switch "switch0" \
209 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
213 ucidef_add_switch "switch0" \
214 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
219 ucidef_set_interface_raw "eth" "eth0"
220 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
239 ucidef_set_interfaces_lan_wan "eth1" "eth0"
240 ucidef_add_switch "switch0" \
241 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
245 ucidef_add_switch "switch0" \
246 "0@eth0" "1:lan" "2:wan"
250 ucidef_add_switch "switch0" \
251 "0@eth0" "5:lan" "1:wan"
255 ucidef_set_interfaces_lan_wan "eth0" "eth1"
256 ucidef_add_switch "switch0" \
257 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
261 ucidef_set_interfaces_lan_wan "eth0" "eth1"
262 ucidef_add_switch "switch0" \
263 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
267 ucidef_set_interfaces_lan_wan "eth0" "eth1"
268 ucidef_add_switch "switch0" \
269 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
275 ucidef_add_switch "switch0" \
276 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
277 mac=$(mtd_get_mac_ascii nvram "wan_mac")
278 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
283 ucidef_add_switch "switch0" \
284 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
285 mac=$(mtd_get_mac_ascii devdata "wanmac")
286 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
290 ucidef_set_interface_lan "wlan0"
297 ucidef_add_switch "switch0" \
298 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
299 mac_lan=$(mtd_get_mac_binary caldata 0)
300 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
301 mac_wan=$(mtd_get_mac_binary caldata 6)
302 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
307 ucidef_add_switch "switch0" \
308 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
309 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
310 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
315 ucidef_set_interface_lan "eth0 eth1"
319 ucidef_set_interface_lan "eth0"
320 ucidef_add_switch "switch0" \
321 "0@eth0" "2:lan" "3:lan" "4:lan"
322 ucidef_add_switch_attr "switch0" "enable" "false"
377 ucidef_set_interface_lan "eth0"
381 ucidef_set_interface_lan "eth0" "dhcp"
387 ucidef_set_interface_lan "eth1"
407 ucidef_set_interfaces_lan_wan "eth1" "eth0"
411 ucidef_set_interfaces_lan_wan "eth1" "eth0"
412 ucidef_add_switch "switch0" \
413 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
417 ucidef_set_interfaces_lan_wan "eth0" "eth1"
418 ucidef_add_switch "switch0" \
419 "0@eth0" "1:lan" "5:wan" "6@eth1"
423 ucidef_add_switch "switch0" \
424 "0@eth0" "1:lan" "2:wan"
428 ucidef_add_switch "switch0" \
429 "0@eth0" "3:lan" "2:wan"
433 ucidef_add_switch "switch0" \
434 "0@eth0" "2:lan" "3:wan"
439 ucidef_set_interfaces_lan_wan "eth0" "eth1"
443 ucidef_add_switch "switch0" \
444 "5:lan" "1:wan" "6@eth0"
483 ucidef_set_interfaces_lan_wan "eth0" "eth1"
484 ucidef_add_switch "switch0" \
485 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
489 ucidef_add_switch "switch0" \
490 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
494 ucidef_add_switch "switch0" \
495 "0@eth0" "1:lan" "2:lan" "3:wan"
499 ucidef_set_interfaces_lan_wan "eth0" "eth1"
500 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
504 ucidef_set_interfaces_lan_wan "eth0" "eth1"
505 ucidef_add_switch "switch0" \
506 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
508 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
509 ucidef_add_switch_attr "switch0" "blinkrate" 2
511 # Port 1 controls the GREEN configuration of LEDs for
512 # the switch and the section does not correspond to a real
515 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
516 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
517 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
518 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
519 # 14: Link (master); 15: separate register
520 ucidef_add_switch_port_attr "switch0" 1 led 6
522 # Port 2 controls the ORANGE configuration of LEDs for
523 # the switch and the section does not correspond to a real
526 # See the key above for switch port 1 for the meaning of the
527 # 'led' setting below.
528 ucidef_add_switch_port_attr "switch0" 2 led 9
530 # Port 5 controls the configuration of the WAN LED and the
531 # section does not correspond to a real switch port.
533 # To toggle the use of green or orange LEDs for the WAN port,
534 # see the LED setting for wndr3700:green:wan in /etc/config/system.
536 # See the key above for switch port 1 for the meaning of the
537 # 'led' setting below.
538 ucidef_add_switch_port_attr "switch0" 5 led 2
542 ucidef_set_interfaces_lan_wan "eth0" "eth1"