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"
61 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
62 ucidef_add_switch
"switch0" "1" "1"
63 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
64 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
65 ucidef_add_switch
"switch1" "1" "1"
66 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
70 ucidef_set_interface_raw
"sfp" "eth0.3"
71 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
78 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
79 ucidef_add_switch
"switch0" "1" "1"
80 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
84 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
85 ucidef_add_switch
"switch0" "1" "1"
86 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
90 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
91 ucidef_add_switch
"switch0" "1" "1"
92 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
93 ucidef_add_switch_vlan
"switch0" "2" "5 6"
98 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
99 ucidef_add_switch
"switch0" "1" "1"
100 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
104 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
105 ucidef_add_switch
"switch0" "1" "1"
106 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
110 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
111 ucidef_add_switch
"switch0" "1" "1"
112 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
117 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
118 ucidef_add_switch
"switch0" "1" "1"
119 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
127 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
128 ucidef_add_switch
"switch0" "1" "1"
129 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
130 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
134 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
135 ucidef_add_switch
"switch0" "1" "1"
136 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
137 ucidef_add_switch
"switch1" "1" "1"
138 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
139 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
145 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
146 ucidef_add_switch
"switch0" "1" "1"
147 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
148 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
153 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
154 ucidef_add_switch
"switch0" "1" "1"
155 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
156 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
160 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
161 ucidef_add_switch
"switch0" "1" "1"
162 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
163 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch0" "1" "1"
169 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
170 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
175 ucidef_set_interface_raw
"eth" "eth0"
176 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
185 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
186 ucidef_add_switch
"switch0" "1" "1"
187 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
191 ucidef_set_interface_lan
"eth0"
192 ucidef_add_switch
"switch0" "1" "1"
193 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
197 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
203 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
204 ucidef_add_switch
"switch0" "1" "1"
205 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
210 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
211 ucidef_add_switch
"switch0" "1" "1"
212 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
213 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
214 mac
=$
(mtd_get_mac_ascii nvram
"^wan_mac")
215 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
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 1 2 3 4"
223 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
224 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
225 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
230 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
231 ucidef_add_switch
"switch0" "1" "1"
232 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
233 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
234 mac_lan
=$
(mtd_get_mac_binary caldata
0)
235 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
236 mac_wan
=$
(mtd_get_mac_binary caldata
6)
237 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
264 ucidef_set_interface_lan
"eth0"
268 ucidef_set_interface_lan
"eth1"
281 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
310 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
311 ucidef_add_switch
"switch0" "1" "1"
312 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
316 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
317 ucidef_add_switch
"switch0" "1" "1"
318 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
319 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
323 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
324 ucidef_add_switch
"switch0" "1" "1"
325 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
326 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
330 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
331 ucidef_add_switch
"switch0" "1" "1"
332 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
336 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
337 ucidef_add_switch
"switch0" "1" "1"
338 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
339 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
340 uci
set network.@switch
[-1].blinkrate
='2'
342 ucidef_add_switch_port
"switch0" "1"
343 # Port 1 controls the GREEN configuration of LEDs for
344 # the switch and the section does not correspond to a real
347 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
348 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
349 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
350 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
351 # 14: Link (master); 15: separate register
352 uci
set network.@switch_port
[-1].led
='6'
354 ucidef_add_switch_port
"switch0" "2"
355 # Port 2 controls the ORANGE configuration of LEDs for
356 # the switch and the section does not correspond to a real
359 # See the key above for switch port 1 for the meaning of the
360 # 'led' setting below.
361 uci
set network.@switch_port
[-1].led
='9'
363 ucidef_add_switch_port
"switch0" "5"
364 # Port 5 controls the configuration of the WAN LED and the
365 # section does not correspond to a real switch port.
367 # To toggle the use of green or orange LEDs for the WAN port,
368 # see the LED setting for wndr3700:green:wan in /etc/config/system.
370 # See the key above for switch port 1 for the meaning of the
371 # 'led' setting below.
372 uci
set network.@switch_port
[-1].led
='2'
376 ucidef_set_interfaces_lan_wan
"eth0" "eth1"