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" "1" "1"
29 ucidef_add_switch_ports
"switch0" \
30 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
35 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
36 ucidef_add_switch
"switch0" "1" "1"
37 ucidef_add_switch_ports
"switch0" \
38 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
43 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
44 ucidef_add_switch
"switch0" "1" "1"
45 ucidef_add_switch_ports
"switch0" \
46 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
53 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
54 ucidef_add_switch
"switch0" "1" "1"
55 ucidef_add_switch_ports
"switch0" \
56 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
62 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
63 ucidef_add_switch
"switch0" "1" "1"
64 ucidef_add_switch_ports
"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" "1" "1"
71 ucidef_add_switch_ports
"switch0" \
72 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
73 ucidef_set_interface_wlan
77 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
78 ucidef_add_switch
"switch0" "1" "1"
79 ucidef_add_switch_ports
"switch0" \
80 "0@eth0" "5:lan" "4:wan"
84 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
85 ucidef_add_switch
"switch0" "1" "1"
86 ucidef_add_switch_ports
"switch0" \
87 "0@eth0" "4:lan" "5:wan"
96 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
97 ucidef_add_switch
"switch0" "1" "1"
100 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
101 ucidef_add_switch_ports
"switch0" \
102 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
105 ucidef_add_switch_ports
"switch0" \
106 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
110 ucidef_add_switch
"switch1" "1" "1"
111 ucidef_add_switch_ports
"switch1" \
112 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
117 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
118 ucidef_add_switch
"switch0" "1" "1"
119 ucidef_add_switch_ports
"switch0" \
120 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
124 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_ports
"switch0" \
127 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
128 "0@eth0" "1:wan" # XXX: confirm cpu ports!
132 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_ports
"switch0" \
135 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
140 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
141 ucidef_add_switch
"switch0" "1" "1"
142 ucidef_add_switch_ports
"switch0" \
143 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
150 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
151 ucidef_add_switch
"switch0" "1" "1"
152 ucidef_add_switch_ports
"switch0" \
153 "1:lan" "2:lan" "5@eth1"
157 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
158 ucidef_add_switch
"switch0" "1" "1"
159 ucidef_add_switch_ports
"switch0" \
160 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
164 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
165 ucidef_add_switch
"switch0" "1" "1"
166 ucidef_add_switch_ports
"switch0" \
167 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
172 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
173 ucidef_add_switch
"switch0" "1" "1"
174 ucidef_add_switch_ports
"switch0" \
175 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
183 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
184 ucidef_add_switch
"switch0" "1" "1"
185 ucidef_add_switch_ports
"switch0" \
186 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
190 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
194 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
195 ucidef_add_switch
"switch0" "1" "1"
196 ucidef_add_switch_ports
"switch0" \
197 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
198 ucidef_add_switch
"switch1" "1" "1"
199 ucidef_add_switch_ports
"switch1" \
200 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
206 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
207 ucidef_add_switch
"switch0" "1" "1"
208 ucidef_add_switch_ports
"switch0" \
209 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
213 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
214 ucidef_add_switch
"switch0" "1" "1"
215 ucidef_add_switch_ports
"switch0" \
216 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
221 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
222 ucidef_add_switch
"switch0" "1" "1"
223 ucidef_add_switch_ports
"switch0" \
224 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
228 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
229 ucidef_add_switch
"switch0" "1" "1"
230 ucidef_add_switch_ports
"switch0" \
231 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
235 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
236 ucidef_add_switch
"switch0" "1" "1"
237 ucidef_add_switch_ports
"switch0" \
238 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
243 ucidef_set_interface_raw
"eth" "eth0"
244 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
261 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
262 ucidef_add_switch
"switch0" "1" "1"
263 ucidef_add_switch_ports
"switch0" \
264 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
268 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
269 ucidef_add_switch
"switch0" "1" "1"
270 ucidef_add_switch_ports
"switch0" \
271 "0@eth0" "1:lan" "2:wan"
275 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
276 ucidef_add_switch
"switch0" "1" "1"
277 ucidef_add_switch_ports
"switch0" \
278 "0@eth0" "5:lan" "1:wan"
282 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
283 ucidef_add_switch
"switch0" "1" "1"
284 ucidef_add_switch_ports
"switch0" \
285 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
289 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
290 ucidef_add_switch
"switch0" "1" "1"
291 ucidef_add_switch_ports
"switch0" \
292 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
298 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
299 ucidef_add_switch
"switch0" "1" "1"
300 ucidef_add_switch_ports
"switch0" \
301 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
302 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
303 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
308 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
309 ucidef_add_switch
"switch0" "1" "1"
310 ucidef_add_switch_ports
"switch0" \
311 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
312 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
313 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
317 ucidef_set_interface_lan
"wlan0"
324 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
325 ucidef_add_switch
"switch0" "1" "1"
326 ucidef_add_switch_ports
"switch0" \
327 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
328 mac_lan
=$
(mtd_get_mac_binary caldata
0)
329 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
330 mac_wan
=$
(mtd_get_mac_binary caldata
6)
331 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
336 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
337 ucidef_add_switch
"switch0" "1" "1"
338 ucidef_add_switch_ports
"switch0" \
339 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
340 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
341 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
346 ucidef_set_interface_lan
"eth0 eth1"
350 ucidef_set_interface_lan
"eth0"
351 ucidef_add_switch
"switch0"
352 ucidef_add_switch_attr
"switch0" "reset" "false"
353 ucidef_add_switch_ports
"switch0" \
354 "0@eth0" "2:lan" "3:lan" "4:lan"
402 ucidef_set_interface_lan
"eth0"
407 ucidef_set_interface_lan
"eth1"
423 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
427 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
428 ucidef_add_switch
"switch0" "1" "1"
429 ucidef_add_switch_ports
"switch0" \
430 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
434 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
435 ucidef_add_switch
"switch0" "1" "1"
436 ucidef_add_switch_ports
"switch0" \
437 "0@eth0" "3:lan" "2:wan"
441 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
445 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
446 ucidef_add_switch
"switch0" "1" "1"
447 ucidef_add_switch_ports
"switch0" \
448 "5:lan" "1:wan" "6@eth0"
484 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
485 ucidef_add_switch
"switch0" "1" "1"
486 ucidef_add_switch_ports
"switch0" \
487 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
491 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
492 ucidef_add_switch
"switch0" "1" "1"
493 ucidef_add_switch_ports
"switch0" \
494 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
498 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
499 ucidef_add_switch
"switch0" "1" "1"
500 ucidef_add_switch_ports
"switch0" \
501 "0@eth0" "1:lan" "2:lan" "3:wan"
505 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
506 ucidef_add_switch
"switch0" "1" "1"
507 ucidef_add_switch_ports
"switch0" "0@eth0" "2:lan" "3:lan"
511 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
512 ucidef_add_switch
"switch0" "1" "1"
513 ucidef_add_switch_ports
"switch0" \
514 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
516 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
517 ucidef_add_switch_attr
"switch0" "blinkrate" 2
519 # Port 1 controls the GREEN configuration of LEDs for
520 # the switch and the section does not correspond to a real
523 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
524 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
525 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
526 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
527 # 14: Link (master); 15: separate register
528 ucidef_add_switch_port_attr
"switch0" 1 led
6
530 # Port 2 controls the ORANGE configuration of LEDs for
531 # the switch and the section does not correspond to a real
534 # See the key above for switch port 1 for the meaning of the
535 # 'led' setting below.
536 ucidef_add_switch_port_attr
"switch0" 2 led
9
538 # Port 5 controls the configuration of the WAN LED and the
539 # section does not correspond to a real switch port.
541 # To toggle the use of green or orange LEDs for the WAN port,
542 # see the LED setting for wndr3700:green:wan in /etc/config/system.
544 # See the key above for switch port 1 for the meaning of the
545 # 'led' setting below.
546 ucidef_add_switch_port_attr
"switch0" 5 led
2
550 ucidef_set_interfaces_lan_wan
"eth0" "eth1"