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"
51 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
52 ucidef_add_switch
"switch0" "1" "1"
53 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
54 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 2 3 4 5"
63 ucidef_add_switch_vlan
"switch0" "2" "1 6"
72 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
73 ucidef_add_switch
"switch0" "1" "1"
74 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
75 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
76 ucidef_add_switch
"switch1" "1" "1"
77 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
80 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
81 ucidef_set_interface_raw
"sfp" "eth0.3"
82 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
89 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
90 ucidef_add_switch
"switch0" "1" "1"
91 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
95 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
96 ucidef_add_switch
"switch0" "1" "1"
97 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
101 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
102 ucidef_add_switch
"switch0" "1" "1"
103 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
104 ucidef_add_switch_vlan
"switch0" "2" "5 6"
109 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
110 ucidef_add_switch
"switch0" "1" "1"
111 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
115 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
116 ucidef_add_switch
"switch0" "1" "1"
117 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
121 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
122 ucidef_add_switch
"switch0" "1" "1"
123 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
128 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
129 ucidef_add_switch
"switch0" "1" "1"
130 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
138 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
139 ucidef_add_switch
"switch0" "1" "1"
140 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
141 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
145 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
149 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
150 ucidef_add_switch
"switch0" "1" "1"
151 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
152 ucidef_add_switch
"switch1" "1" "1"
153 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
154 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
160 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
161 ucidef_add_switch
"switch0" "1" "1"
162 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
163 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
167 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
168 ucidef_add_switch
"switch0" "1" "1"
169 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
173 ucidef_set_interface_lan
"eth0"
178 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
179 ucidef_add_switch
"switch0" "1" "1"
180 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
181 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
185 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
186 ucidef_add_switch
"switch0" "1" "1"
187 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
188 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
192 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
193 ucidef_add_switch
"switch0" "1" "1"
194 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
195 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
200 ucidef_set_interface_raw
"eth" "eth0"
201 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
212 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
213 ucidef_add_switch
"switch0" "1" "1"
214 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
218 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
219 ucidef_add_switch
"switch0" "1" "1"
220 ucidef_add_switch_vlan
"switch0" "1" "0t 1"
221 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
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 5"
228 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
232 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
233 ucidef_add_switch
"switch0" "1" "1"
234 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
238 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
239 ucidef_add_switch
"switch0" "1" "1"
240 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
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
=$
(mtd_get_mac_ascii nvram
"wan_mac")
250 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
255 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
256 ucidef_add_switch
"switch0" "1" "1"
257 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
258 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
259 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
260 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
267 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
268 ucidef_add_switch
"switch0" "1" "1"
269 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
270 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
271 mac_lan
=$
(mtd_get_mac_binary caldata
0)
272 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
273 mac_wan
=$
(mtd_get_mac_binary caldata
6)
274 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
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 u-boot-env
"wanaddr")
284 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
323 ucidef_set_interface_lan
"eth0"
327 ucidef_set_interface_lan
"eth1"
341 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
373 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
374 ucidef_add_switch
"switch0" "1" "1"
375 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
379 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
380 ucidef_add_switch
"switch0" "1" "1"
381 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
382 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
386 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
387 ucidef_add_switch
"switch0" "1" "1"
388 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
389 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
393 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
394 ucidef_add_switch
"switch0" "1" "1"
395 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
399 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
400 ucidef_add_switch
"switch0" "1" "1"
401 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
402 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
403 uci
set network.@switch
[-1].blinkrate
='2'
405 ucidef_add_switch_port
"switch0" "1"
406 # Port 1 controls the GREEN configuration of LEDs for
407 # the switch and the section does not correspond to a real
410 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
411 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
412 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
413 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
414 # 14: Link (master); 15: separate register
415 uci
set network.@switch_port
[-1].led
='6'
417 ucidef_add_switch_port
"switch0" "2"
418 # Port 2 controls the ORANGE configuration of LEDs for
419 # the switch and the section does not correspond to a real
422 # See the key above for switch port 1 for the meaning of the
423 # 'led' setting below.
424 uci
set network.@switch_port
[-1].led
='9'
426 ucidef_add_switch_port
"switch0" "5"
427 # Port 5 controls the configuration of the WAN LED and the
428 # section does not correspond to a real switch port.
430 # To toggle the use of green or orange LEDs for the WAN port,
431 # see the LED setting for wndr3700:green:wan in /etc/config/system.
433 # See the key above for switch port 1 for the meaning of the
434 # 'led' setting below.
435 uci
set network.@switch_port
[-1].led
='2'
439 ucidef_set_interfaces_lan_wan
"eth0" "eth1"