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.1" "eth0.2"
35 ucidef_add_switch
"switch0" "1" "1"
36 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
37 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
41 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
42 ucidef_add_switch
"switch0" "1" "1"
43 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
44 ucidef_add_switch_vlan
"switch0" "2" "5 6"
50 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
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"
58 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
59 ucidef_add_switch
"switch0" "1" "1"
60 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
61 ucidef_add_switch_vlan
"switch0" "2" "1 6"
69 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
70 ucidef_add_switch
"switch0" "1" "1"
71 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
72 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
73 ucidef_add_switch
"switch1" "1" "1"
74 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
77 rb-2011uas
* | rb-2011uias
)
78 ucidef_set_interface_raw
"sfp" "eth0.3"
79 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
86 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
87 ucidef_add_switch
"switch0" "1" "1"
88 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
92 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
93 ucidef_add_switch
"switch0" "1" "1"
94 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
98 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
99 ucidef_add_switch
"switch0" "1" "1"
100 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
101 ucidef_add_switch_vlan
"switch0" "2" "5 6"
106 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
107 ucidef_add_switch
"switch0" "1" "1"
108 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
112 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
113 ucidef_add_switch
"switch0" "1" "1"
114 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
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 5"
125 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
126 ucidef_add_switch
"switch0" "1" "1"
127 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
135 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
136 ucidef_add_switch
"switch0" "1" "1"
137 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
138 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
142 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
146 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
147 ucidef_add_switch
"switch0" "1" "1"
148 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
149 ucidef_add_switch
"switch1" "1" "1"
150 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
151 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
157 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
158 ucidef_add_switch
"switch0" "1" "1"
159 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
160 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
164 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
165 ucidef_add_switch
"switch0" "1" "1"
166 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
170 ucidef_set_interface_lan
"eth0"
175 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
176 ucidef_add_switch
"switch0" "1" "1"
177 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
178 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
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 5t"
185 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
189 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
190 ucidef_add_switch
"switch0" "1" "1"
191 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
192 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
197 ucidef_set_interface_raw
"eth" "eth0"
198 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
207 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
208 ucidef_add_switch
"switch0" "1" "1"
209 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
213 ucidef_set_interface_lan
"eth0"
214 ucidef_add_switch
"switch0" "1" "1"
215 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
219 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
220 ucidef_add_switch
"switch0" "1" "1"
221 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
225 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
226 ucidef_add_switch
"switch0" "1" "1"
227 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
232 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
233 ucidef_add_switch
"switch0" "1" "1"
234 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
235 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
236 mac
=$
(mtd_get_mac_ascii nvram
"^wan_mac")
237 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
242 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
243 ucidef_add_switch
"switch0" "1" "1"
244 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
245 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
246 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
247 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
252 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
253 ucidef_add_switch
"switch0" "1" "1"
254 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
255 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
256 mac_lan
=$
(mtd_get_mac_binary caldata
0)
257 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
258 mac_wan
=$
(mtd_get_mac_binary caldata
6)
259 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
289 ucidef_set_interface_lan
"eth0"
293 ucidef_set_interface_lan
"eth1"
307 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
338 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
339 ucidef_add_switch
"switch0" "1" "1"
340 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
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 2 3 4 5"
347 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
351 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
352 ucidef_add_switch
"switch0" "1" "1"
353 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
354 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
358 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
359 ucidef_add_switch
"switch0" "1" "1"
360 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
364 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
365 ucidef_add_switch
"switch0" "1" "1"
366 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
367 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
368 uci
set network.@switch
[-1].blinkrate
='2'
370 ucidef_add_switch_port
"switch0" "1"
371 # Port 1 controls the GREEN configuration of LEDs for
372 # the switch and the section does not correspond to a real
375 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
376 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
377 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
378 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
379 # 14: Link (master); 15: separate register
380 uci
set network.@switch_port
[-1].led
='6'
382 ucidef_add_switch_port
"switch0" "2"
383 # Port 2 controls the ORANGE configuration of LEDs for
384 # the switch and the section does not correspond to a real
387 # See the key above for switch port 1 for the meaning of the
388 # 'led' setting below.
389 uci
set network.@switch_port
[-1].led
='9'
391 ucidef_add_switch_port
"switch0" "5"
392 # Port 5 controls the configuration of the WAN LED and the
393 # section does not correspond to a real switch port.
395 # To toggle the use of green or orange LEDs for the WAN port,
396 # see the LED setting for wndr3700:green:wan in /etc/config/system.
398 # See the key above for switch port 1 for the meaning of the
399 # 'led' setting below.
400 uci
set network.@switch_port
[-1].led
='2'
404 ucidef_set_interfaces_lan_wan
"eth0" "eth1"