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"
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 2 3 4 5"
160 ucidef_add_switch_vlan "switch0" "2" "0t 1"
164 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
167 ucidef_add_switch_vlan "switch0" "2" "0 5t"
171 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
172 ucidef_add_switch "switch0" "1" "1"
173 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
174 ucidef_add_switch_vlan "switch0" "2" "0 9t"
179 ucidef_set_interface_raw "eth" "eth0"
180 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
189 ucidef_set_interfaces_lan_wan "eth1" "eth0"
190 ucidef_add_switch "switch0" "1" "1"
191 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
195 ucidef_set_interface_lan "eth0"
196 ucidef_add_switch "switch0" "1" "1"
197 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
201 ucidef_set_interfaces_lan_wan "eth0" "eth1"
202 ucidef_add_switch "switch0" "1" "1"
203 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
207 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
208 ucidef_add_switch "switch0" "1" "1"
209 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
214 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
215 ucidef_add_switch "switch0" "1" "1"
216 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
217 ucidef_add_switch_vlan "switch0" "2" "0t 5"
218 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
219 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
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 devdata "wanmac")
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_lan=$(mtd_get_mac_binary caldata 0)
239 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
240 mac_wan=$(mtd_get_mac_binary caldata 6)
241 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
268 ucidef_set_interface_lan "eth0"
272 ucidef_set_interface_lan "eth1"
285 ucidef_set_interfaces_lan_wan "eth1" "eth0"
316 ucidef_set_interfaces_lan_wan "eth0" "eth1"
317 ucidef_add_switch "switch0" "1" "1"
318 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
322 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
323 ucidef_add_switch "switch0" "1" "1"
324 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
325 ucidef_add_switch_vlan "switch0" "2" "0t 1"
329 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
330 ucidef_add_switch "switch0" "1" "1"
331 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
332 ucidef_add_switch_vlan "switch0" "2" "0t 3"
336 ucidef_set_interfaces_lan_wan "eth0" "eth1"
337 ucidef_add_switch "switch0" "1" "1"
338 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
342 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
343 ucidef_add_switch "switch0" "1" "1"
344 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
345 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
346 uci set network.@switch[-1].blinkrate='2'
348 ucidef_add_switch_port "switch0" "1"
349 # Port 1 controls the GREEN configuration of LEDs for
350 # the switch and the section does not correspond to a real
353 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
354 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
355 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
356 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
357 # 14: Link (master); 15: separate register
358 uci set network.@switch_port[-1].led='6'
360 ucidef_add_switch_port "switch0" "2"
361 # Port 2 controls the ORANGE configuration of LEDs for
362 # the switch and the section does not correspond to a real
365 # See the key above for switch port 1 for the meaning of the
366 # 'led' setting below.
367 uci set network.@switch_port[-1].led='9'
369 ucidef_add_switch_port "switch0" "5"
370 # Port 5 controls the configuration of the WAN LED and the
371 # section does not correspond to a real switch port.
373 # To toggle the use of green or orange LEDs for the WAN port,
374 # see the LED setting for wndr3700:green:wan in /etc/config/system.
376 # See the key above for switch port 1 for the meaning of the
377 # 'led' setting below.
378 uci set network.@switch_port[-1].led='2'
382 ucidef_set_interfaces_lan_wan "eth0" "eth1"