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
"eth1" "eth0"
138 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
139 ucidef_add_switch
"switch0" "1" "1"
140 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
141 ucidef_add_switch
"switch1" "1" "1"
142 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
143 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
149 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
150 ucidef_add_switch
"switch0" "1" "1"
151 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
152 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
156 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
157 ucidef_add_switch
"switch0" "1" "1"
158 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
162 ucidef_set_interface_lan
"eth0"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch0" "1" "1"
169 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
170 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
174 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
175 ucidef_add_switch
"switch0" "1" "1"
176 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
177 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
181 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
182 ucidef_add_switch
"switch0" "1" "1"
183 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
184 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
189 ucidef_set_interface_raw
"eth" "eth0"
190 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
199 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
200 ucidef_add_switch
"switch0" "1" "1"
201 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
205 ucidef_set_interface_lan
"eth0"
206 ucidef_add_switch
"switch0" "1" "1"
207 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
211 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
212 ucidef_add_switch
"switch0" "1" "1"
213 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
217 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
218 ucidef_add_switch
"switch0" "1" "1"
219 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
224 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
225 ucidef_add_switch
"switch0" "1" "1"
226 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
227 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
228 mac
=$
(mtd_get_mac_ascii nvram
"^wan_mac")
229 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
234 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
235 ucidef_add_switch
"switch0" "1" "1"
236 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
237 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
238 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
239 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
244 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
245 ucidef_add_switch
"switch0" "1" "1"
246 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
247 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
248 mac_lan
=$
(mtd_get_mac_binary caldata
0)
249 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
250 mac_wan
=$
(mtd_get_mac_binary caldata
6)
251 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
280 ucidef_set_interface_lan
"eth0"
284 ucidef_set_interface_lan
"eth1"
297 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
328 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
329 ucidef_add_switch
"switch0" "1" "1"
330 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
334 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
335 ucidef_add_switch
"switch0" "1" "1"
336 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
337 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
341 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
342 ucidef_add_switch
"switch0" "1" "1"
343 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
344 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
348 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
349 ucidef_add_switch
"switch0" "1" "1"
350 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
354 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
355 ucidef_add_switch
"switch0" "1" "1"
356 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
357 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
358 uci
set network.@switch
[-1].blinkrate
='2'
360 ucidef_add_switch_port
"switch0" "1"
361 # Port 1 controls the GREEN configuration of LEDs for
362 # the switch and the section does not correspond to a real
365 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
366 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
367 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
368 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
369 # 14: Link (master); 15: separate register
370 uci
set network.@switch_port
[-1].led
='6'
372 ucidef_add_switch_port
"switch0" "2"
373 # Port 2 controls the ORANGE configuration of LEDs for
374 # the switch and the section does not correspond to a real
377 # See the key above for switch port 1 for the meaning of the
378 # 'led' setting below.
379 uci
set network.@switch_port
[-1].led
='9'
381 ucidef_add_switch_port
"switch0" "5"
382 # Port 5 controls the configuration of the WAN LED and the
383 # section does not correspond to a real switch port.
385 # To toggle the use of green or orange LEDs for the WAN port,
386 # see the LED setting for wndr3700:green:wan in /etc/config/system.
388 # See the key above for switch port 1 for the meaning of the
389 # 'led' setting below.
390 uci
set network.@switch_port
[-1].led
='2'
394 ucidef_set_interfaces_lan_wan
"eth0" "eth1"