3 # Copyright (C) 2011-2015 OpenWrt.org
6 .
/lib
/functions
/uci-defaults-new.sh
11 ucidef_set_interface_loopback
13 board
=$
(ar71xx_board_name
)
22 ucidef_set_interface_lan
"eth0 eth1"
27 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
28 ucidef_add_switch
"switch0" \
29 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
34 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
35 ucidef_add_switch
"switch0" \
36 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
41 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
42 ucidef_add_switch
"switch0" \
43 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
50 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
51 ucidef_add_switch
"switch0" \
52 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
58 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
59 ucidef_add_switch
"switch0" \
60 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
64 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
65 ucidef_add_switch
"switch0" \
66 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
67 ucidef_set_interface_wlan
71 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
72 ucidef_add_switch
"switch0" \
73 "0@eth0" "5:lan" "4:wan"
77 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
78 ucidef_add_switch
"switch0" \
79 "0@eth0" "4:lan" "5:wan"
88 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
91 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
92 ucidef_add_switch
"switch0" \
93 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
96 ucidef_add_switch
"switch0" \
97 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
101 ucidef_add_switch
"switch1" \
102 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
107 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
108 ucidef_add_switch
"switch0" \
109 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
113 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
114 ucidef_add_switch
"switch0" \
115 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
116 "0@eth0" "1:wan" # XXX: confirm cpu ports!
120 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
121 ucidef_add_switch
"switch0" \
122 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
127 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
128 ucidef_add_switch
"switch0" \
129 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
136 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
137 ucidef_add_switch
"switch0" \
138 "1:lan" "2:lan" "5@eth1"
142 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
143 ucidef_add_switch
"switch0" \
144 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
148 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
149 ucidef_add_switch
"switch0" \
150 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
155 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
156 ucidef_add_switch
"switch0" \
157 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
165 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
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_set_interfaces_lan_wan
"eth0.1" "eth0.2"
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!
198 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
199 ucidef_add_switch
"switch0" \
200 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
204 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
205 ucidef_add_switch
"switch0" \
206 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
210 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
211 ucidef_add_switch
"switch0" \
212 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
217 ucidef_set_interface_raw
"eth" "eth0"
218 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
235 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
236 ucidef_add_switch
"switch0" \
237 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
241 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
242 ucidef_add_switch
"switch0" \
243 "0@eth0" "1:lan" "2:wan"
247 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
248 ucidef_add_switch
"switch0" \
249 "0@eth0" "5:lan" "1:wan"
253 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
254 ucidef_add_switch
"switch0" \
255 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
259 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
260 ucidef_add_switch
"switch0" \
261 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
267 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
268 ucidef_add_switch
"switch0" \
269 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
270 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
271 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
276 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
277 ucidef_add_switch
"switch0" \
278 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
279 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
280 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
284 ucidef_set_interface_lan
"wlan0"
291 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
292 ucidef_add_switch
"switch0" \
293 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
294 mac_lan
=$
(mtd_get_mac_binary caldata
0)
295 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
296 mac_wan
=$
(mtd_get_mac_binary caldata
6)
297 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
302 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
303 ucidef_add_switch
"switch0" \
304 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
305 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
306 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
311 ucidef_set_interface_lan
"eth0 eth1"
315 ucidef_set_interface_lan
"eth0"
316 ucidef_add_switch
"switch0"
317 ucidef_add_switch_attr
"switch0" "reset" "false"
318 ucidef_add_switch_ports
"switch0" \
319 "0@eth0" "2:lan" "3:lan" "4:lan"
367 ucidef_set_interface_lan
"eth0"
372 ucidef_set_interface_lan
"eth1"
388 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
392 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
393 ucidef_add_switch
"switch0" \
394 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
398 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
399 ucidef_add_switch
"switch0" \
400 "0@eth0" "3:lan" "2:wan"
404 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
408 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
409 ucidef_add_switch
"switch0" \
410 "5:lan" "1:wan" "6@eth0"
446 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
447 ucidef_add_switch
"switch0" \
448 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
452 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
453 ucidef_add_switch
"switch0" \
454 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
458 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
459 ucidef_add_switch
"switch0" \
460 "0@eth0" "1:lan" "2:lan" "3:wan"
464 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
465 ucidef_add_switch
"switch0" "0@eth0" "2:lan" "3:lan"
469 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
470 ucidef_add_switch
"switch0" \
471 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
473 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
474 ucidef_add_switch_attr
"switch0" "blinkrate" 2
476 # Port 1 controls the GREEN configuration of LEDs for
477 # the switch and the section does not correspond to a real
480 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
481 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
482 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
483 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
484 # 14: Link (master); 15: separate register
485 ucidef_add_switch_port_attr
"switch0" 1 led
6
487 # Port 2 controls the ORANGE configuration of LEDs for
488 # the switch and the section does not correspond to a real
491 # See the key above for switch port 1 for the meaning of the
492 # 'led' setting below.
493 ucidef_add_switch_port_attr
"switch0" 2 led
9
495 # Port 5 controls the configuration of the WAN LED and the
496 # section does not correspond to a real switch port.
498 # To toggle the use of green or orange LEDs for the WAN port,
499 # see the LED setting for wndr3700:green:wan in /etc/config/system.
501 # See the key above for switch port 1 for the meaning of the
502 # 'led' setting below.
503 ucidef_add_switch_port_attr
"switch0" 5 led
2
507 ucidef_set_interfaces_lan_wan
"eth0" "eth1"