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"
91 ucidef_set_interfaces_lan_wan "eth1" "eth0"
92 ucidef_add_switch "switch0" "1" "1"
93 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
97 ucidef_set_interfaces_lan_wan "eth1" "eth0"
98 ucidef_add_switch "switch0" "1" "1"
99 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
103 ucidef_set_interfaces_lan_wan "eth1" "eth0"
104 ucidef_add_switch "switch0" "1" "1"
105 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
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 4"
120 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
121 ucidef_add_switch "switch0" "1" "1"
122 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
123 ucidef_add_switch_vlan "switch0" "2" "0t 1"
127 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
128 ucidef_add_switch "switch0" "1" "1"
129 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
130 ucidef_add_switch "switch1" "1" "1"
131 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
132 ucidef_add_switch_vlan "switch1" "2" "0t 5"
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 1 3 4 5"
141 ucidef_add_switch_vlan "switch0" "2" "0t 2"
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
147 ucidef_add_switch "switch0" "1" "1"
148 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
149 ucidef_add_switch_vlan "switch0" "2" "0t 1"
153 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
154 ucidef_add_switch "switch0" "1" "1"
155 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
156 ucidef_add_switch_vlan "switch0" "2" "0 5t"
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 9t"
163 ucidef_add_switch_vlan "switch0" "2" "0 9t"
168 ucidef_set_interface_raw "eth" "eth0"
169 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
178 ucidef_set_interfaces_lan_wan "eth1" "eth0"
179 ucidef_add_switch "switch0" "1" "1"
180 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
184 ucidef_set_interface_lan "eth0"
185 ucidef_add_switch "switch0" "1" "1"
186 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
190 ucidef_set_interfaces_lan_wan "eth0" "eth1"
191 ucidef_add_switch "switch0" "1" "1"
192 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
196 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
197 ucidef_add_switch "switch0" "1" "1"
198 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
203 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
204 ucidef_add_switch "switch0" "1" "1"
205 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
206 ucidef_add_switch_vlan "switch0" "2" "0t 5"
207 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
208 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
213 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
216 ucidef_add_switch_vlan "switch0" "2" "0t 5"
217 mac=$(mtd_get_mac_ascii devdata "wanmac")
218 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
223 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
224 ucidef_add_switch "switch0" "1" "1"
225 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
226 ucidef_add_switch_vlan "switch0" "2" "0t 5"
227 mac_lan=$(mtd_get_mac_binary caldata 0)
228 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
229 mac_wan=$(mtd_get_mac_binary caldata 6)
230 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
257 ucidef_set_interface_lan "eth0"
261 ucidef_set_interface_lan "eth1"
274 ucidef_set_interfaces_lan_wan "eth1" "eth0"
302 ucidef_set_interfaces_lan_wan "eth0" "eth1"
303 ucidef_add_switch "switch0" "1" "1"
304 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
308 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
309 ucidef_add_switch "switch0" "1" "1"
310 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
311 ucidef_add_switch_vlan "switch0" "2" "0t 1"
315 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
316 ucidef_add_switch "switch0" "1" "1"
317 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
318 ucidef_add_switch_vlan "switch0" "2" "0t 3"
322 ucidef_set_interfaces_lan_wan "eth0" "eth1"
323 ucidef_add_switch "switch0" "1" "1"
324 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
328 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
329 ucidef_add_switch "switch0" "1" "1"
330 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
331 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
332 uci set network.@switch[-1].blinkrate='2'
334 ucidef_add_switch_port "switch0" "1"
335 # Port 1 controls the GREEN configuration of LEDs for
336 # the switch and the section does not correspond to a real
339 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
340 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
341 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
342 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
343 # 14: Link (master); 15: separate register
344 uci set network.@switch_port[-1].led='6'
346 ucidef_add_switch_port "switch0" "2"
347 # Port 2 controls the ORANGE configuration of LEDs for
348 # the switch and the section does not correspond to a real
351 # See the key above for switch port 1 for the meaning of the
352 # 'led' setting below.
353 uci set network.@switch_port[-1].led='9'
355 ucidef_add_switch_port "switch0" "5"
356 # Port 5 controls the configuration of the WAN LED and the
357 # section does not correspond to a real switch port.
359 # To toggle the use of green or orange LEDs for the WAN port,
360 # see the LED setting for wndr3700:green:wan in /etc/config/system.
362 # See the key above for switch port 1 for the meaning of the
363 # 'led' setting below.
364 uci set network.@switch_port[-1].led='2'
368 ucidef_set_interfaces_lan_wan "eth0" "eth1"