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.1" "eth0.2"
35 ucidef_add_switch "switch0" "1" "1"
36 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
37 ucidef_add_switch_vlan "switch0" "2" "0t 1"
41 ucidef_set_interfaces_lan_wan "eth0" "eth1"
42 ucidef_add_switch "switch0" "1" "1"
43 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
44 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 1 2 3 4"
54 ucidef_add_switch_vlan "switch0" "2" "5 6"
60 ucidef_set_interfaces_lan_wan "eth1" "eth0"
61 ucidef_add_switch "switch0" "1" "1"
62 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
63 ucidef_add_switch_vlan "switch0" "2" "1 6"
67 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
68 ucidef_add_switch "switch0" "1" "1"
69 ucidef_add_switch_vlan "switch0" "1" "0t 5"
70 ucidef_add_switch_vlan "switch0" "2" "0t 4"
79 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
80 ucidef_add_switch "switch0" "1" "1"
81 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
82 ucidef_add_switch_vlan "switch0" "2" "0t 1"
83 ucidef_add_switch "switch1" "1" "1"
84 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
87 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
88 ucidef_set_interface_raw "sfp" "eth0.3"
89 ucidef_add_switch_vlan "switch0" "3" "0t 6"
96 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
102 ucidef_set_interfaces_lan_wan "eth1" "eth0"
103 ucidef_add_switch "switch0" "1" "1"
104 ucidef_add_switch_vlan "switch0" "1" "2 3 4 5 6"
105 ucidef_add_switch_vlan "switch0" "2" "0 1"
109 ucidef_set_interfaces_lan_wan "eth0" "eth1"
110 ucidef_add_switch "switch0" "1" "1"
111 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
115 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
116 ucidef_add_switch "switch0" "1" "1"
117 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
118 ucidef_add_switch_vlan "switch0" "2" "5 6"
123 ucidef_set_interfaces_lan_wan "eth1" "eth0"
124 ucidef_add_switch "switch0" "1" "1"
125 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
129 ucidef_set_interfaces_lan_wan "eth1" "eth0"
130 ucidef_add_switch "switch0" "1" "1"
131 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
135 ucidef_set_interfaces_lan_wan "eth1" "eth0"
136 ucidef_add_switch "switch0" "1" "1"
137 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
142 ucidef_set_interfaces_lan_wan "eth1" "eth0"
143 ucidef_add_switch "switch0" "1" "1"
144 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
152 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153 ucidef_add_switch "switch0" "1" "1"
154 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
155 ucidef_add_switch_vlan "switch0" "2" "0t 1"
159 ucidef_set_interfaces_lan_wan "eth1" "eth0"
163 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
164 ucidef_add_switch "switch0" "1" "1"
165 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
166 ucidef_add_switch "switch1" "1" "1"
167 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
168 ucidef_add_switch_vlan "switch1" "2" "0t 5"
174 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
175 ucidef_add_switch "switch0" "1" "1"
176 ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
177 ucidef_add_switch_vlan "switch0" "2" "0t 2"
181 ucidef_set_interfaces_lan_wan "eth1" "eth0"
182 ucidef_add_switch "switch0" "1" "1"
183 ucidef_add_switch_vlan "switch0" "1" "0 1 3"
187 ucidef_set_interface_lan "eth0"
192 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
193 ucidef_add_switch "switch0" "1" "1"
194 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
195 ucidef_add_switch_vlan "switch0" "2" "0t 1"
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
200 ucidef_add_switch "switch0" "1" "1"
201 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
202 ucidef_add_switch_vlan "switch0" "2" "0 5t"
206 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
207 ucidef_add_switch "switch0" "1" "1"
208 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
209 ucidef_add_switch_vlan "switch0" "2" "0 9t"
214 ucidef_set_interface_raw "eth" "eth0"
215 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
229 ucidef_set_interfaces_lan_wan "eth1" "eth0"
230 ucidef_add_switch "switch0" "1" "1"
231 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
235 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
236 ucidef_add_switch "switch0" "1" "1"
237 ucidef_add_switch_vlan "switch0" "1" "0t 1"
238 ucidef_add_switch_vlan "switch0" "2" "0t 2"
242 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
243 ucidef_add_switch "switch0" "1" "1"
244 ucidef_add_switch_vlan "switch0" "1" "0t 5"
245 ucidef_add_switch_vlan "switch0" "2" "0t 1"
249 ucidef_set_interfaces_lan_wan "eth0" "eth1"
250 ucidef_add_switch "switch0" "1" "1"
251 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
255 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
256 ucidef_add_switch "switch0" "1" "1"
257 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
263 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
264 ucidef_add_switch "switch0" "1" "1"
265 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
266 ucidef_add_switch_vlan "switch0" "2" "0t 5"
267 mac=$(mtd_get_mac_ascii nvram "wan_mac")
268 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
273 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
274 ucidef_add_switch "switch0" "1" "1"
275 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
276 ucidef_add_switch_vlan "switch0" "2" "0t 5"
277 mac=$(mtd_get_mac_ascii devdata "wanmac")
278 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
285 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
286 ucidef_add_switch "switch0" "1" "1"
287 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
288 ucidef_add_switch_vlan "switch0" "2" "0t 5"
289 mac_lan=$(mtd_get_mac_binary caldata 0)
290 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
291 mac_wan=$(mtd_get_mac_binary caldata 6)
292 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
297 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
298 ucidef_add_switch "switch0" "1" "1"
299 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
300 ucidef_add_switch_vlan "switch0" "2" "0t 5"
301 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
302 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
342 ucidef_set_interface_lan "eth0"
346 ucidef_set_interface_lan "eth1"
360 ucidef_set_interfaces_lan_wan "eth1" "eth0"
392 ucidef_set_interfaces_lan_wan "eth0" "eth1"
393 ucidef_add_switch "switch0" "1" "1"
394 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
398 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
399 ucidef_add_switch "switch0" "1" "1"
400 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
401 ucidef_add_switch_vlan "switch0" "2" "0t 1"
405 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
406 ucidef_add_switch "switch0" "1" "1"
407 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
408 ucidef_add_switch_vlan "switch0" "2" "0t 3"
412 ucidef_set_interfaces_lan_wan "eth0" "eth1"
413 ucidef_add_switch "switch0" "1" "1"
414 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
418 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
419 ucidef_add_switch "switch0" "1" "1"
420 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
421 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
422 uci set network.@switch[-1].blinkrate='2'
424 ucidef_add_switch_port "switch0" "1"
425 # Port 1 controls the GREEN configuration of LEDs for
426 # the switch and the section does not correspond to a real
429 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
430 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
431 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
432 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
433 # 14: Link (master); 15: separate register
434 uci set network.@switch_port[-1].led='6'
436 ucidef_add_switch_port "switch0" "2"
437 # Port 2 controls the ORANGE configuration of LEDs for
438 # the switch and the section does not correspond to a real
441 # See the key above for switch port 1 for the meaning of the
442 # 'led' setting below.
443 uci set network.@switch_port[-1].led='9'
445 ucidef_add_switch_port "switch0" "5"
446 # Port 5 controls the configuration of the WAN LED and the
447 # section does not correspond to a real switch port.
449 # To toggle the use of green or orange LEDs for the WAN port,
450 # see the LED setting for wndr3700:green:wan in /etc/config/system.
452 # See the key above for switch port 1 for the meaning of the
453 # 'led' setting below.
454 uci set network.@switch_port[-1].led='2'
458 ucidef_set_interfaces_lan_wan "eth0" "eth1"