3 # Copyright (C) 2011 OpenWrt.org
6 [ -e /etc
/config
/network
] && exit 0
8 touch /etc
/config
/network
10 .
/lib
/functions
/uci-defaults.sh
13 ucidef_set_interface_loopback
15 board
=$
(ar71xx_board_name
)
23 ucidef_set_interface_lan
"eth0 eth1"
28 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
29 ucidef_add_switch
"switch0" "1" "1"
30 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
31 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
36 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
37 ucidef_add_switch
"switch0" "1" "1"
38 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
39 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
43 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
44 ucidef_add_switch
"switch0" "1" "1"
45 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
46 ucidef_add_switch_vlan
"switch0" "2" "5 6"
50 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
51 ucidef_add_switch
"switch0" "1" "1"
52 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
53 ucidef_add_switch_vlan
"switch0" "2" "5 6"
60 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
61 ucidef_add_switch
"switch0" "1" "1"
62 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
63 ucidef_add_switch_vlan
"switch0" "2" "5 6"
69 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
70 ucidef_add_switch
"switch0" "1" "1"
71 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
72 ucidef_add_switch_vlan
"switch0" "2" "1 6"
76 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
77 ucidef_add_switch
"switch0" "1" "1"
78 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
79 ucidef_set_interface_wlan
83 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
84 ucidef_add_switch
"switch0" "1" "1"
85 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
86 ucidef_add_switch_vlan
"switch0" "2" "0t 4"
95 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
96 ucidef_add_switch
"switch0" "1" "1"
97 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
98 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
99 ucidef_add_switch
"switch1" "1" "1"
100 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
103 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
104 ucidef_set_interface_raw
"sfp" "eth0.3"
105 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
112 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
113 ucidef_add_switch
"switch0" "1" "1"
114 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
118 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "1" "2 3 4 5 6"
121 ucidef_add_switch_vlan
"switch0" "2" "0 1"
125 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
126 ucidef_add_switch
"switch0" "1" "1"
127 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
131 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
132 ucidef_add_switch
"switch0" "1" "1"
133 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
134 ucidef_add_switch_vlan
"switch0" "2" "5 6"
139 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
140 ucidef_add_switch
"switch0" "1" "1"
141 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
145 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
146 ucidef_add_switch
"switch0" "1" "1"
147 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
151 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
152 ucidef_add_switch
"switch0" "1" "1"
153 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
158 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
159 ucidef_add_switch
"switch0" "1" "1"
160 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
168 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
169 ucidef_add_switch
"switch0" "1" "1"
170 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
171 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
175 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
179 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
180 ucidef_add_switch
"switch0" "1" "1"
181 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
182 ucidef_add_switch
"switch1" "1" "1"
183 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
184 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
190 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
191 ucidef_add_switch
"switch0" "1" "1"
192 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
193 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
197 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
204 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
205 ucidef_add_switch
"switch0" "1" "1"
206 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
207 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
211 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
212 ucidef_add_switch
"switch0" "1" "1"
213 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
214 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
218 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
219 ucidef_add_switch
"switch0" "1" "1"
220 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
221 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
226 ucidef_set_interface_raw
"eth" "eth0"
227 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
242 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
243 ucidef_add_switch
"switch0" "1" "1"
244 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
248 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
249 ucidef_add_switch
"switch0" "1" "1"
250 ucidef_add_switch_vlan
"switch0" "1" "0t 1"
251 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
255 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
256 ucidef_add_switch
"switch0" "1" "1"
257 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
258 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
262 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
263 ucidef_add_switch
"switch0" "1" "1"
264 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
268 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
269 ucidef_add_switch
"switch0" "1" "1"
270 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
276 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
277 ucidef_add_switch
"switch0" "1" "1"
278 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
279 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
280 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
281 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
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 devdata
"wanmac")
291 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
295 ucidef_set_interface_lan
"wlan0"
302 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
303 ucidef_add_switch
"switch0" "1" "1"
304 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
305 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
306 mac_lan
=$
(mtd_get_mac_binary caldata
0)
307 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
308 mac_wan
=$
(mtd_get_mac_binary caldata
6)
309 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
314 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
315 ucidef_add_switch
"switch0" "1" "1"
316 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
317 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
318 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
319 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
323 ucidef_set_interface_lan
"eth0 eth1"
327 ucidef_set_interface_lan
"eth0"
328 ucidef_add_switch
"switch0" "1" "0"
329 ucidef_add_switch_vlan
"switch0" "0" "0 2 3 4"
374 ucidef_set_interface_lan
"eth0"
380 ucidef_set_interface_lan
"eth1"
394 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
398 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
399 ucidef_add_switch
"switch0" "1" "1"
400 ucidef_add_switch_vlan
"switch0" "1" "0t 3"
401 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
405 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
409 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
410 ucidef_add_switch
"switch0" "1" "1"
411 ucidef_add_switch_vlan
"switch0" "1" "5 6t"
412 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
446 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
447 ucidef_add_switch
"switch0" "1" "1"
448 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
452 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
453 ucidef_add_switch
"switch0" "1" "1"
454 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
455 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
459 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
460 ucidef_add_switch
"switch0" "1" "1"
461 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
462 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
466 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
467 ucidef_add_switch
"switch0" "1" "1"
468 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
472 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
473 ucidef_add_switch
"switch0" "1" "1"
474 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
475 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
476 uci
set network.@switch
[-1].blinkrate
='2'
478 ucidef_add_switch_port
"switch0" "1"
479 # Port 1 controls the GREEN configuration of LEDs for
480 # the switch and the section does not correspond to a real
483 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
484 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
485 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
486 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
487 # 14: Link (master); 15: separate register
488 uci
set network.@switch_port
[-1].led
='6'
490 ucidef_add_switch_port
"switch0" "2"
491 # Port 2 controls the ORANGE configuration of LEDs for
492 # the switch and the section does not correspond to a real
495 # See the key above for switch port 1 for the meaning of the
496 # 'led' setting below.
497 uci
set network.@switch_port
[-1].led
='9'
499 ucidef_add_switch_port
"switch0" "5"
500 # Port 5 controls the configuration of the WAN LED and the
501 # section does not correspond to a real switch port.
503 # To toggle the use of green or orange LEDs for the WAN port,
504 # see the LED setting for wndr3700:green:wan in /etc/config/system.
506 # See the key above for switch port 1 for the meaning of the
507 # 'led' setting below.
508 uci
set network.@switch_port
[-1].led
='2'
512 ucidef_set_interfaces_lan_wan
"eth0" "eth1"