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_vlan
"switch0" "1" "0t 2 3 4 5"
30 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
35 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
36 ucidef_add_switch
"switch0" "1" "1"
37 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
38 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
42 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
43 ucidef_add_switch
"switch0" "1" "1"
44 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
45 ucidef_add_switch_vlan
"switch0" "2" "5 6"
49 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
50 ucidef_add_switch
"switch0" "1" "1"
51 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
52 ucidef_add_switch_vlan
"switch0" "2" "5 6"
59 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
60 ucidef_add_switch
"switch0" "1" "1"
61 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
62 ucidef_add_switch_vlan
"switch0" "2" "5 6"
68 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
69 ucidef_add_switch
"switch0" "1" "1"
70 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
71 ucidef_add_switch_vlan
"switch0" "2" "1 6"
75 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
76 ucidef_add_switch
"switch0" "1" "1"
77 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
78 ucidef_set_interface_wlan
82 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
83 ucidef_add_switch
"switch0" "1" "1"
84 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
85 ucidef_add_switch_vlan
"switch0" "2" "0t 4"
89 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
90 ucidef_add_switch
"switch0" "1" "1"
91 ucidef_add_switch_vlan
"switch0" "1" "0t 4"
92 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
101 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
102 ucidef_add_switch
"switch0" "1" "1"
103 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
104 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
105 ucidef_add_switch
"switch1" "1" "1"
106 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
109 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
110 ucidef_set_interface_raw
"sfp" "eth0.3"
111 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
118 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
124 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_vlan
"switch0" "1" "2 3 4 5 6"
127 ucidef_add_switch_vlan
"switch0" "2" "0 1"
131 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
132 ucidef_add_switch
"switch0" "1" "1"
133 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
138 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
139 ucidef_add_switch
"switch0" "1" "1"
140 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
141 ucidef_add_switch_vlan
"switch0" "2" "5 6"
147 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
148 ucidef_add_switch
"switch0" "1" "1"
149 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
153 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
154 ucidef_add_switch
"switch0" "1" "1"
155 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
159 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
160 ucidef_add_switch
"switch0" "1" "1"
161 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
166 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
167 ucidef_add_switch
"switch0" "1" "1"
168 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
176 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
177 ucidef_add_switch
"switch0" "1" "1"
178 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
179 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
183 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
187 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
188 ucidef_add_switch
"switch0" "1" "1"
189 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
190 ucidef_add_switch
"switch1" "1" "1"
191 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
192 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
198 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
199 ucidef_add_switch
"switch0" "1" "1"
200 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
201 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
205 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
206 ucidef_add_switch
"switch0" "1" "1"
207 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
212 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
213 ucidef_add_switch
"switch0" "1" "1"
214 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
215 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
219 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
220 ucidef_add_switch
"switch0" "1" "1"
221 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
222 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
226 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
227 ucidef_add_switch
"switch0" "1" "1"
228 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
229 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
234 ucidef_set_interface_raw
"eth" "eth0"
235 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
252 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
253 ucidef_add_switch
"switch0" "1" "1"
254 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
258 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
259 ucidef_add_switch
"switch0" "1" "1"
260 ucidef_add_switch_vlan
"switch0" "1" "0t 1"
261 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
265 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
266 ucidef_add_switch
"switch0" "1" "1"
267 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
268 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
272 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
273 ucidef_add_switch
"switch0" "1" "1"
274 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
278 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
279 ucidef_add_switch
"switch0" "1" "1"
280 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
286 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
287 ucidef_add_switch
"switch0" "1" "1"
288 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
289 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
290 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
291 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
296 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
297 ucidef_add_switch
"switch0" "1" "1"
298 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
299 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
300 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
301 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
305 ucidef_set_interface_lan
"wlan0"
312 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
313 ucidef_add_switch
"switch0" "1" "1"
314 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
315 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
316 mac_lan
=$
(mtd_get_mac_binary caldata
0)
317 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
318 mac_wan
=$
(mtd_get_mac_binary caldata
6)
319 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
324 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
325 ucidef_add_switch
"switch0" "1" "1"
326 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
327 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
328 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
329 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
333 ucidef_set_interface_lan
"eth0 eth1"
337 ucidef_set_interface_lan
"eth0"
338 ucidef_add_switch
"switch0" "1" "0"
339 ucidef_add_switch_vlan
"switch0" "0" "0 2 3 4"
387 ucidef_set_interface_lan
"eth0"
392 ucidef_set_interface_lan
"eth1"
406 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
410 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
411 ucidef_add_switch
"switch0" "1" "1"
412 ucidef_add_switch_vlan
"switch0" "1" "0t 3"
413 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
417 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
421 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
422 ucidef_add_switch
"switch0" "1" "1"
423 ucidef_add_switch_vlan
"switch0" "1" "5 6t"
424 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
459 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
460 ucidef_add_switch
"switch0" "1" "1"
461 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
465 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
466 ucidef_add_switch
"switch0" "1" "1"
467 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
468 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
472 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
473 ucidef_add_switch
"switch0" "1" "1"
474 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
475 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
479 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
480 ucidef_add_switch
"switch0" "1" "1"
481 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
485 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
486 ucidef_add_switch
"switch0" "1" "1"
487 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
488 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
489 uci
set network.@switch
[-1].blinkrate
='2'
491 ucidef_add_switch_port
"switch0" "1"
492 # Port 1 controls the GREEN configuration of LEDs for
493 # the switch and the section does not correspond to a real
496 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
497 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
498 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
499 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
500 # 14: Link (master); 15: separate register
501 uci
set network.@switch_port
[-1].led
='6'
503 ucidef_add_switch_port
"switch0" "2"
504 # Port 2 controls the ORANGE configuration of LEDs for
505 # the switch and the section does not correspond to a real
508 # See the key above for switch port 1 for the meaning of the
509 # 'led' setting below.
510 uci
set network.@switch_port
[-1].led
='9'
512 ucidef_add_switch_port
"switch0" "5"
513 # Port 5 controls the configuration of the WAN LED and the
514 # section does not correspond to a real switch port.
516 # To toggle the use of green or orange LEDs for the WAN port,
517 # see the LED setting for wndr3700:green:wan in /etc/config/system.
519 # See the key above for switch port 1 for the meaning of the
520 # 'led' setting below.
521 uci
set network.@switch_port
[-1].led
='2'
525 ucidef_set_interfaces_lan_wan
"eth0" "eth1"