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
"eth0.1" "eth0.2"
77 ucidef_add_switch
"switch0" "1" "1"
78 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
79 ucidef_add_switch_vlan
"switch0" "2" "0t 4"
88 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
89 ucidef_add_switch
"switch0" "1" "1"
90 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
91 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
92 ucidef_add_switch
"switch1" "1" "1"
93 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
96 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
97 ucidef_set_interface_raw
"sfp" "eth0.3"
98 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
105 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
106 ucidef_add_switch
"switch0" "1" "1"
107 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
111 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
112 ucidef_add_switch
"switch0" "1" "1"
113 ucidef_add_switch_vlan
"switch0" "1" "2 3 4 5 6"
114 ucidef_add_switch_vlan
"switch0" "2" "0 1"
118 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
124 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
127 ucidef_add_switch_vlan
"switch0" "2" "5 6"
132 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
138 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
139 ucidef_add_switch
"switch0" "1" "1"
140 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
144 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
145 ucidef_add_switch
"switch0" "1" "1"
146 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
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 4"
161 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
162 ucidef_add_switch
"switch0" "1" "1"
163 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
164 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
168 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
172 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
173 ucidef_add_switch
"switch0" "1" "1"
174 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
175 ucidef_add_switch
"switch1" "1" "1"
176 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
177 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
183 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
184 ucidef_add_switch
"switch0" "1" "1"
185 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
186 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
190 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
191 ucidef_add_switch
"switch0" "1" "1"
192 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
197 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
200 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
204 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
205 ucidef_add_switch
"switch0" "1" "1"
206 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
207 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
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 9t"
214 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
219 ucidef_set_interface_raw
"eth" "eth0"
220 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
235 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
236 ucidef_add_switch
"switch0" "1" "1"
237 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
241 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
242 ucidef_add_switch
"switch0" "1" "1"
243 ucidef_add_switch_vlan
"switch0" "1" "0t 1"
244 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
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 5"
251 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
255 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
256 ucidef_add_switch
"switch0" "1" "1"
257 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
261 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
262 ucidef_add_switch
"switch0" "1" "1"
263 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
269 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
270 ucidef_add_switch
"switch0" "1" "1"
271 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
272 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
273 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
274 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
279 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
280 ucidef_add_switch
"switch0" "1" "1"
281 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
282 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
283 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
284 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
288 ucidef_set_interface_lan
"wlan0"
295 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
296 ucidef_add_switch
"switch0" "1" "1"
297 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
298 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
299 mac_lan
=$
(mtd_get_mac_binary caldata
0)
300 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
301 mac_wan
=$
(mtd_get_mac_binary caldata
6)
302 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
307 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
308 ucidef_add_switch
"switch0" "1" "1"
309 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
310 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
311 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
312 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
316 ucidef_set_interface_lan
"eth0 eth1"
320 ucidef_set_interface_lan
"eth0"
321 ucidef_add_switch
"switch0" "1" "0"
322 ucidef_add_switch_vlan
"switch0" "0" "0 2 3 4"
367 ucidef_set_interface_lan
"eth0"
373 ucidef_set_interface_lan
"eth1"
387 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
391 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
392 ucidef_add_switch
"switch0" "1" "1"
393 ucidef_add_switch_vlan
"switch0" "1" "0t 3"
394 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
398 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
402 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
403 ucidef_add_switch
"switch0" "1" "1"
404 ucidef_add_switch_vlan
"switch0" "1" "5 6t"
405 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
439 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
440 ucidef_add_switch
"switch0" "1" "1"
441 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
445 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
446 ucidef_add_switch
"switch0" "1" "1"
447 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
448 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
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 1 2"
455 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
459 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
460 ucidef_add_switch
"switch0" "1" "1"
461 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
465 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
466 ucidef_add_switch
"switch0" "1" "1"
467 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
468 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
469 uci
set network.@switch
[-1].blinkrate
='2'
471 ucidef_add_switch_port
"switch0" "1"
472 # Port 1 controls the GREEN configuration of LEDs for
473 # the switch and the section does not correspond to a real
476 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
477 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
478 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
479 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
480 # 14: Link (master); 15: separate register
481 uci
set network.@switch_port
[-1].led
='6'
483 ucidef_add_switch_port
"switch0" "2"
484 # Port 2 controls the ORANGE configuration of LEDs for
485 # the switch and the section does not correspond to a real
488 # See the key above for switch port 1 for the meaning of the
489 # 'led' setting below.
490 uci
set network.@switch_port
[-1].led
='9'
492 ucidef_add_switch_port
"switch0" "5"
493 # Port 5 controls the configuration of the WAN LED and the
494 # section does not correspond to a real switch port.
496 # To toggle the use of green or orange LEDs for the WAN port,
497 # see the LED setting for wndr3700:green:wan in /etc/config/system.
499 # See the key above for switch port 1 for the meaning of the
500 # 'led' setting below.
501 uci
set network.@switch_port
[-1].led
='2'
505 ucidef_set_interfaces_lan_wan
"eth0" "eth1"