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.1" "eth0.2"
220 ucidef_add_switch
"switch0" "1" "1"
221 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
222 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
226 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
227 ucidef_add_switch
"switch0" "1" "1"
228 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
232 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
233 ucidef_add_switch
"switch0" "1" "1"
234 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
239 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
240 ucidef_add_switch
"switch0" "1" "1"
241 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
242 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
243 mac
=$
(mtd_get_mac_ascii nvram
"^wan_mac")
244 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
249 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
250 ucidef_add_switch
"switch0" "1" "1"
251 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
252 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
253 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
254 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
259 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
260 ucidef_add_switch
"switch0" "1" "1"
261 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
262 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
263 mac_lan
=$
(mtd_get_mac_binary caldata
0)
264 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
265 mac_wan
=$
(mtd_get_mac_binary caldata
6)
266 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
271 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
272 ucidef_add_switch
"switch0" "1" "1"
273 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
274 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
275 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
276 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
308 ucidef_set_interface_lan
"eth0"
312 ucidef_set_interface_lan
"eth1"
326 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
357 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
358 ucidef_add_switch
"switch0" "1" "1"
359 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
363 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
364 ucidef_add_switch
"switch0" "1" "1"
365 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
366 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
370 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
371 ucidef_add_switch
"switch0" "1" "1"
372 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
373 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
377 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
378 ucidef_add_switch
"switch0" "1" "1"
379 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
383 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
384 ucidef_add_switch
"switch0" "1" "1"
385 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
386 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
387 uci
set network.@switch
[-1].blinkrate
='2'
389 ucidef_add_switch_port
"switch0" "1"
390 # Port 1 controls the GREEN configuration of LEDs for
391 # the switch and the section does not correspond to a real
394 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
395 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
396 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
397 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
398 # 14: Link (master); 15: separate register
399 uci
set network.@switch_port
[-1].led
='6'
401 ucidef_add_switch_port
"switch0" "2"
402 # Port 2 controls the ORANGE configuration of LEDs for
403 # the switch and the section does not correspond to a real
406 # See the key above for switch port 1 for the meaning of the
407 # 'led' setting below.
408 uci
set network.@switch_port
[-1].led
='9'
410 ucidef_add_switch_port
"switch0" "5"
411 # Port 5 controls the configuration of the WAN LED and the
412 # section does not correspond to a real switch port.
414 # To toggle the use of green or orange LEDs for the WAN port,
415 # see the LED setting for wndr3700:green:wan in /etc/config/system.
417 # See the key above for switch port 1 for the meaning of the
418 # 'led' setting below.
419 uci
set network.@switch_port
[-1].led
='2'
423 ucidef_set_interfaces_lan_wan
"eth0" "eth1"