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
)
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"
34 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
35 ucidef_add_switch
"switch0" "1" "1"
36 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
37 ucidef_add_switch_vlan
"switch0" "2" "5 6"
43 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
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"
51 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
52 ucidef_add_switch
"switch0" "1" "1"
53 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
54 ucidef_add_switch_vlan
"switch0" "2" "1 6"
62 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
63 ucidef_add_switch
"switch0" "1" "1"
64 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
65 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
66 ucidef_add_switch
"switch1" "1" "1"
67 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
70 rb-2011uas
* | rb-2011uias
)
71 ucidef_set_interface_raw
"sfp" "eth0.3"
72 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
79 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
80 ucidef_add_switch
"switch0" "1" "1"
81 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
85 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
86 ucidef_add_switch
"switch0" "1" "1"
87 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
91 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
92 ucidef_add_switch
"switch0" "1" "1"
93 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
94 ucidef_add_switch_vlan
"switch0" "2" "5 6"
99 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
100 ucidef_add_switch
"switch0" "1" "1"
101 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
105 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
106 ucidef_add_switch
"switch0" "1" "1"
107 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
111 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
112 ucidef_add_switch
"switch0" "1" "1"
113 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
118 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
128 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
129 ucidef_add_switch
"switch0" "1" "1"
130 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
131 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
135 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
139 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
140 ucidef_add_switch
"switch0" "1" "1"
141 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
142 ucidef_add_switch
"switch1" "1" "1"
143 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
144 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
150 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
151 ucidef_add_switch
"switch0" "1" "1"
152 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
153 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
157 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
158 ucidef_add_switch
"switch0" "1" "1"
159 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
163 ucidef_set_interface_lan
"eth0"
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
"eth0.1" "eth0.2"
176 ucidef_add_switch
"switch0" "1" "1"
177 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
178 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
182 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
183 ucidef_add_switch
"switch0" "1" "1"
184 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
185 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
190 ucidef_set_interface_raw
"eth" "eth0"
191 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
200 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
201 ucidef_add_switch
"switch0" "1" "1"
202 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
206 ucidef_set_interface_lan
"eth0"
207 ucidef_add_switch
"switch0" "1" "1"
208 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
212 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
213 ucidef_add_switch
"switch0" "1" "1"
214 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
218 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
219 ucidef_add_switch
"switch0" "1" "1"
220 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
225 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
226 ucidef_add_switch
"switch0" "1" "1"
227 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
228 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
229 mac
=$
(mtd_get_mac_ascii nvram
"^wan_mac")
230 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
235 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
236 ucidef_add_switch
"switch0" "1" "1"
237 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
238 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
239 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
240 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
245 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
246 ucidef_add_switch
"switch0" "1" "1"
247 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
248 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
249 mac_lan
=$
(mtd_get_mac_binary caldata
0)
250 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
251 mac_wan
=$
(mtd_get_mac_binary caldata
6)
252 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
282 ucidef_set_interface_lan
"eth0"
286 ucidef_set_interface_lan
"eth1"
300 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
331 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
332 ucidef_add_switch
"switch0" "1" "1"
333 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
337 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
338 ucidef_add_switch
"switch0" "1" "1"
339 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
340 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
344 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
345 ucidef_add_switch
"switch0" "1" "1"
346 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
347 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
351 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
352 ucidef_add_switch
"switch0" "1" "1"
353 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
357 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
358 ucidef_add_switch
"switch0" "1" "1"
359 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
360 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
361 uci
set network.@switch
[-1].blinkrate
='2'
363 ucidef_add_switch_port
"switch0" "1"
364 # Port 1 controls the GREEN configuration of LEDs for
365 # the switch and the section does not correspond to a real
368 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
369 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
370 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
371 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
372 # 14: Link (master); 15: separate register
373 uci
set network.@switch_port
[-1].led
='6'
375 ucidef_add_switch_port
"switch0" "2"
376 # Port 2 controls the ORANGE configuration of LEDs for
377 # the switch and the section does not correspond to a real
380 # See the key above for switch port 1 for the meaning of the
381 # 'led' setting below.
382 uci
set network.@switch_port
[-1].led
='9'
384 ucidef_add_switch_port
"switch0" "5"
385 # Port 5 controls the configuration of the WAN LED and the
386 # section does not correspond to a real switch port.
388 # To toggle the use of green or orange LEDs for the WAN port,
389 # see the LED setting for wndr3700:green:wan in /etc/config/system.
391 # See the key above for switch port 1 for the meaning of the
392 # 'led' setting below.
393 uci
set network.@switch_port
[-1].led
='2'
397 ucidef_set_interfaces_lan_wan
"eth0" "eth1"