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"
48 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
49 ucidef_add_switch
"switch0" \
50 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
56 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
57 ucidef_add_switch
"switch0" \
58 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
62 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
63 ucidef_add_switch
"switch0" \
64 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
65 ucidef_set_interface_wlan
69 ucidef_add_switch
"switch0" \
70 "0@eth0" "5:lan" "4:wan"
74 ucidef_add_switch
"switch0" \
75 "0@eth0" "4:lan" "5:wan"
85 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
86 ucidef_add_switch
"switch0" \
87 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
90 ucidef_add_switch
"switch0" \
91 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
95 ucidef_add_switch
"switch1" \
96 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
101 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
102 ucidef_add_switch
"switch0" \
103 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
107 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
108 ucidef_add_switch
"switch0" \
109 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
110 "0@eth0" "1:wan" # XXX: confirm cpu ports!
114 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
115 ucidef_add_switch
"switch0" \
116 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
121 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
122 ucidef_add_switch
"switch0" \
123 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
130 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
131 ucidef_add_switch
"switch0" \
132 "1:lan" "2:lan" "5@eth1"
136 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
137 ucidef_add_switch
"switch0" \
138 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
142 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
143 ucidef_add_switch
"switch0" \
144 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
149 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
150 ucidef_add_switch
"switch0" \
151 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
159 ucidef_add_switch
"switch0" \
160 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
164 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
168 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
169 ucidef_add_switch
"switch0" \
170 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
171 ucidef_add_switch
"switch1" \
172 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
178 ucidef_add_switch
"switch0" \
179 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
183 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
184 ucidef_add_switch
"switch0" \
185 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
190 ucidef_add_switch
"switch0" \
191 "0@eth0" "1:wan" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
195 ucidef_add_switch
"switch0" \
196 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
200 ucidef_add_switch
"switch0" \
201 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
206 ucidef_set_interface_raw
"eth" "eth0"
207 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
224 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
225 ucidef_add_switch
"switch0" \
226 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
230 ucidef_add_switch
"switch0" \
231 "0@eth0" "1:lan" "2:wan"
235 ucidef_add_switch
"switch0" \
236 "0@eth0" "5:lan" "1:wan"
240 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
241 ucidef_add_switch
"switch0" \
242 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
246 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
247 ucidef_add_switch
"switch0" \
248 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
254 ucidef_add_switch
"switch0" \
255 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
256 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
257 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
262 ucidef_add_switch
"switch0" \
263 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
264 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
265 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
269 ucidef_set_interface_lan
"wlan0"
276 ucidef_add_switch
"switch0" \
277 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
278 mac_lan
=$
(mtd_get_mac_binary caldata
0)
279 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
280 mac_wan
=$
(mtd_get_mac_binary caldata
6)
281 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
286 ucidef_add_switch
"switch0" \
287 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
288 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
289 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
294 ucidef_set_interface_lan
"eth0 eth1"
298 ucidef_set_interface_lan
"eth0"
299 ucidef_add_switch
"switch0"
300 ucidef_add_switch_attr
"switch0" "reset" "false"
301 ucidef_add_switch_ports
"switch0" \
302 "0@eth0" "2:lan" "3:lan" "4:lan"
350 ucidef_set_interface_lan
"eth0"
355 ucidef_set_interface_lan
"eth1"
371 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
375 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
376 ucidef_add_switch
"switch0" \
377 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
381 ucidef_add_switch
"switch0" \
382 "0@eth0" "3:lan" "2:wan"
386 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
390 ucidef_add_switch
"switch0" \
391 "5:lan" "1:wan" "6@eth0"
427 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
428 ucidef_add_switch
"switch0" \
429 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
433 ucidef_add_switch
"switch0" \
434 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
438 ucidef_add_switch
"switch0" \
439 "0@eth0" "1:lan" "2:lan" "3:wan"
443 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
444 ucidef_add_switch
"switch0" "0@eth0" "2:lan" "3:lan"
448 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
449 ucidef_add_switch
"switch0" \
450 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
452 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
453 ucidef_add_switch_attr
"switch0" "blinkrate" 2
455 # Port 1 controls the GREEN configuration of LEDs for
456 # the switch and the section does not correspond to a real
459 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
460 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
461 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
462 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
463 # 14: Link (master); 15: separate register
464 ucidef_add_switch_port_attr
"switch0" 1 led
6
466 # Port 2 controls the ORANGE configuration of LEDs for
467 # the switch and the section does not correspond to a real
470 # See the key above for switch port 1 for the meaning of the
471 # 'led' setting below.
472 ucidef_add_switch_port_attr
"switch0" 2 led
9
474 # Port 5 controls the configuration of the WAN LED and the
475 # section does not correspond to a real switch port.
477 # To toggle the use of green or orange LEDs for the WAN port,
478 # see the LED setting for wndr3700:green:wan in /etc/config/system.
480 # See the key above for switch port 1 for the meaning of the
481 # 'led' setting below.
482 ucidef_add_switch_port_attr
"switch0" 5 led
2
486 ucidef_set_interfaces_lan_wan
"eth0" "eth1"