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"
59 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
60 ucidef_add_switch
"switch0" "1" "1"
61 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
62 ucidef_add_switch_vlan
"switch0" "2" "1 6"
70 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
71 ucidef_add_switch
"switch0" "1" "1"
72 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
73 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
74 ucidef_add_switch
"switch1" "1" "1"
75 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
78 rb-2011uas
* | rb-2011uias
)
79 ucidef_set_interface_raw
"sfp" "eth0.3"
80 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
87 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
88 ucidef_add_switch
"switch0" "1" "1"
89 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
93 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
94 ucidef_add_switch
"switch0" "1" "1"
95 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
99 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
100 ucidef_add_switch
"switch0" "1" "1"
101 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
102 ucidef_add_switch_vlan
"switch0" "2" "5 6"
107 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
108 ucidef_add_switch
"switch0" "1" "1"
109 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
113 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
114 ucidef_add_switch
"switch0" "1" "1"
115 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
119 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
120 ucidef_add_switch
"switch0" "1" "1"
121 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
126 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
127 ucidef_add_switch
"switch0" "1" "1"
128 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
136 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
137 ucidef_add_switch
"switch0" "1" "1"
138 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
139 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
143 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
147 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
148 ucidef_add_switch
"switch0" "1" "1"
149 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
150 ucidef_add_switch
"switch1" "1" "1"
151 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
152 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
158 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
159 ucidef_add_switch
"switch0" "1" "1"
160 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
161 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
165 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
166 ucidef_add_switch
"switch0" "1" "1"
167 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
171 ucidef_set_interface_lan
"eth0"
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
"eth0.1" "eth0.2"
184 ucidef_add_switch
"switch0" "1" "1"
185 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
186 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
190 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
191 ucidef_add_switch
"switch0" "1" "1"
192 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
193 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
198 ucidef_set_interface_raw
"eth" "eth0"
199 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
208 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
209 ucidef_add_switch
"switch0" "1" "1"
210 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
214 ucidef_set_interface_lan
"eth0"
215 ucidef_add_switch
"switch0" "1" "1"
216 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
220 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
221 ucidef_add_switch
"switch0" "1" "1"
222 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
223 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
227 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
228 ucidef_add_switch
"switch0" "1" "1"
229 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
233 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
234 ucidef_add_switch
"switch0" "1" "1"
235 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
240 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
241 ucidef_add_switch
"switch0" "1" "1"
242 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
243 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
244 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
245 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
250 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
251 ucidef_add_switch
"switch0" "1" "1"
252 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
253 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
254 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
255 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
261 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
262 ucidef_add_switch
"switch0" "1" "1"
263 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
264 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
265 mac_lan
=$
(mtd_get_mac_binary caldata
0)
266 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
267 mac_wan
=$
(mtd_get_mac_binary caldata
6)
268 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
273 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
274 ucidef_add_switch
"switch0" "1" "1"
275 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
276 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
277 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
278 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
314 ucidef_set_interface_lan
"eth0"
318 ucidef_set_interface_lan
"eth1"
332 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
363 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
364 ucidef_add_switch
"switch0" "1" "1"
365 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
369 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
370 ucidef_add_switch
"switch0" "1" "1"
371 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
372 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
376 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
377 ucidef_add_switch
"switch0" "1" "1"
378 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
379 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
383 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
384 ucidef_add_switch
"switch0" "1" "1"
385 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
389 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
390 ucidef_add_switch
"switch0" "1" "1"
391 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
392 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
393 uci
set network.@switch
[-1].blinkrate
='2'
395 ucidef_add_switch_port
"switch0" "1"
396 # Port 1 controls the GREEN configuration of LEDs for
397 # the switch and the section does not correspond to a real
400 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
401 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
402 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
403 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
404 # 14: Link (master); 15: separate register
405 uci
set network.@switch_port
[-1].led
='6'
407 ucidef_add_switch_port
"switch0" "2"
408 # Port 2 controls the ORANGE configuration of LEDs for
409 # the switch and the section does not correspond to a real
412 # See the key above for switch port 1 for the meaning of the
413 # 'led' setting below.
414 uci
set network.@switch_port
[-1].led
='9'
416 ucidef_add_switch_port
"switch0" "5"
417 # Port 5 controls the configuration of the WAN LED and the
418 # section does not correspond to a real switch port.
420 # To toggle the use of green or orange LEDs for the WAN port,
421 # see the LED setting for wndr3700:green:wan in /etc/config/system.
423 # See the key above for switch port 1 for the meaning of the
424 # 'led' setting below.
425 uci
set network.@switch_port
[-1].led
='2'
429 ucidef_set_interfaces_lan_wan
"eth0" "eth1"