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"
50 ucidef_set_interfaces_lan_wan "eth1" "eth0"
51 ucidef_add_switch "switch0" "1" "1"
52 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
53 ucidef_add_switch_vlan "switch0" "2" "1 6"
60 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
61 ucidef_add_switch "switch0" "1" "1"
62 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
63 ucidef_add_switch_vlan "switch0" "2" "0t 1"
64 ucidef_add_switch "switch1" "1" "1"
65 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
69 ucidef_set_interface_raw "sfp" "eth0.3"
70 ucidef_add_switch_vlan "switch0" "3" "0t 6"
77 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
78 ucidef_add_switch "switch0" "1" "1"
79 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
83 ucidef_set_interfaces_lan_wan "eth0" "eth1"
84 ucidef_add_switch "switch0" "1" "1"
85 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
90 ucidef_set_interfaces_lan_wan "eth1" "eth0"
91 ucidef_add_switch "switch0" "1" "1"
92 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
96 ucidef_set_interfaces_lan_wan "eth1" "eth0"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
102 ucidef_set_interfaces_lan_wan "eth1" "eth0"
103 ucidef_add_switch "switch0" "1" "1"
104 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
109 ucidef_set_interfaces_lan_wan "eth1" "eth0"
110 ucidef_add_switch "switch0" "1" "1"
111 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
119 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
120 ucidef_add_switch "switch0" "1" "1"
121 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
122 ucidef_add_switch_vlan "switch0" "2" "0t 1"
126 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
127 ucidef_add_switch "switch0" "1" "1"
128 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
129 ucidef_add_switch "switch1" "1" "1"
130 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
131 ucidef_add_switch_vlan "switch1" "2" "0t 5"
137 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138 ucidef_add_switch "switch0" "1" "1"
139 ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
140 ucidef_add_switch_vlan "switch0" "2" "0t 2"
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 2 3 4 5"
148 ucidef_add_switch_vlan "switch0" "2" "0t 1"
152 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153 ucidef_add_switch "switch0" "1" "1"
154 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
155 ucidef_add_switch_vlan "switch0" "2" "0 5t"
159 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
160 ucidef_add_switch "switch0" "1" "1"
161 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
162 ucidef_add_switch_vlan "switch0" "2" "0 9t"
167 ucidef_set_interface_raw "eth" "eth0"
168 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
177 ucidef_set_interfaces_lan_wan "eth1" "eth0"
178 ucidef_add_switch "switch0" "1" "1"
179 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
183 ucidef_set_interface_lan "eth0"
184 ucidef_add_switch "switch0" "1" "1"
185 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
189 ucidef_set_interfaces_lan_wan "eth0" "eth1"
190 ucidef_add_switch "switch0" "1" "1"
191 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
195 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
196 ucidef_add_switch "switch0" "1" "1"
197 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
202 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
203 ucidef_add_switch "switch0" "1" "1"
204 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
205 ucidef_add_switch_vlan "switch0" "2" "0t 5"
206 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
207 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
212 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
213 ucidef_add_switch "switch0" "1" "1"
214 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
215 ucidef_add_switch_vlan "switch0" "2" "0t 5"
216 mac=$(mtd_get_mac_ascii devdata "wanmac")
217 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
222 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
223 ucidef_add_switch "switch0" "1" "1"
224 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
225 ucidef_add_switch_vlan "switch0" "2" "0t 5"
226 mac_lan=$(mtd_get_mac_binary caldata 0)
227 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
228 mac_wan=$(mtd_get_mac_binary caldata 6)
229 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
256 ucidef_set_interface_lan "eth0"
260 ucidef_set_interface_lan "eth1"
273 ucidef_set_interfaces_lan_wan "eth1" "eth0"
300 ucidef_set_interfaces_lan_wan "eth0" "eth1"
301 ucidef_add_switch "switch0" "1" "1"
302 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
306 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
307 ucidef_add_switch "switch0" "1" "1"
308 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
309 ucidef_add_switch_vlan "switch0" "2" "0t 1"
313 ucidef_set_interface_lan "eth0"
314 ucidef_add_switch "switch0" "1" "1"
315 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
319 ucidef_set_interfaces_lan_wan "eth0" "eth1"
320 ucidef_add_switch "switch0" "1" "1"
321 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
325 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
326 ucidef_add_switch "switch0" "1" "1"
327 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
328 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
329 uci set network.@switch[-1].blinkrate='2'
331 ucidef_add_switch_port "switch0" "1"
332 # Port 1 controls the GREEN configuration of LEDs for
333 # the switch and the section does not correspond to a real
336 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
337 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
338 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
339 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
340 # 14: Link (master); 15: separate register
341 uci set network.@switch_port[-1].led='6'
343 ucidef_add_switch_port "switch0" "2"
344 # Port 2 controls the ORANGE configuration of LEDs for
345 # the switch and the section does not correspond to a real
348 # See the key above for switch port 1 for the meaning of the
349 # 'led' setting below.
350 uci set network.@switch_port[-1].led='9'
352 ucidef_add_switch_port "switch0" "5"
353 # Port 5 controls the configuration of the WAN LED and the
354 # section does not correspond to a real switch port.
356 # To toggle the use of green or orange LEDs for the WAN port,
357 # see the LED setting for wndr3700:green:wan in /etc/config/system.
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='2'
365 ucidef_set_interfaces_lan_wan "eth0" "eth1"