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"
50 ucidef_set_interfaces_lan_wan "eth1" "eth0"
51 ucidef_add_switch "switch0" "1" "1"
52 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
53 ucidef_add_switch_vlan "switch0" "2" "5 6"
58 ucidef_set_interfaces_lan_wan "eth1" "eth0"
59 ucidef_add_switch "switch0" "1" "1"
60 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
61 ucidef_add_switch_vlan "switch0" "2" "1 6"
69 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
70 ucidef_add_switch "switch0" "1" "1"
71 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
72 ucidef_add_switch_vlan "switch0" "2" "0t 1"
73 ucidef_add_switch "switch1" "1" "1"
74 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
77 rb-2011uas* | rb-2011uias)
78 ucidef_set_interface_raw "sfp" "eth0.3"
79 ucidef_add_switch_vlan "switch0" "3" "0t 6"
86 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
87 ucidef_add_switch "switch0" "1" "1"
88 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
92 ucidef_set_interfaces_lan_wan "eth0" "eth1"
93 ucidef_add_switch "switch0" "1" "1"
94 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
98 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
99 ucidef_add_switch "switch0" "1" "1"
100 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
101 ucidef_add_switch_vlan "switch0" "2" "5 6"
106 ucidef_set_interfaces_lan_wan "eth1" "eth0"
107 ucidef_add_switch "switch0" "1" "1"
108 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
112 ucidef_set_interfaces_lan_wan "eth1" "eth0"
113 ucidef_add_switch "switch0" "1" "1"
114 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
118 ucidef_set_interfaces_lan_wan "eth1" "eth0"
119 ucidef_add_switch "switch0" "1" "1"
120 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
125 ucidef_set_interfaces_lan_wan "eth1" "eth0"
126 ucidef_add_switch "switch0" "1" "1"
127 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
135 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
136 ucidef_add_switch "switch0" "1" "1"
137 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
138 ucidef_add_switch_vlan "switch0" "2" "0t 1"
142 ucidef_set_interfaces_lan_wan "eth1" "eth0"
146 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
147 ucidef_add_switch "switch0" "1" "1"
148 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
149 ucidef_add_switch "switch1" "1" "1"
150 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
151 ucidef_add_switch_vlan "switch1" "2" "0t 5"
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 1 3 4 5"
160 ucidef_add_switch_vlan "switch0" "2" "0t 2"
164 ucidef_set_interfaces_lan_wan "eth1" "eth0"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_vlan "switch0" "1" "0 1 3"
170 ucidef_set_interface_lan "eth0"
175 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
176 ucidef_add_switch "switch0" "1" "1"
177 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
178 ucidef_add_switch_vlan "switch0" "2" "0t 1"
182 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
183 ucidef_add_switch "switch0" "1" "1"
184 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
185 ucidef_add_switch_vlan "switch0" "2" "0 5t"
189 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
190 ucidef_add_switch "switch0" "1" "1"
191 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
192 ucidef_add_switch_vlan "switch0" "2" "0 9t"
197 ucidef_set_interface_raw "eth" "eth0"
198 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
207 ucidef_set_interfaces_lan_wan "eth1" "eth0"
208 ucidef_add_switch "switch0" "1" "1"
209 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
213 ucidef_set_interface_lan "eth0"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
219 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
220 ucidef_add_switch "switch0" "1" "1"
221 ucidef_add_switch_vlan "switch0" "1" "0t 5"
222 ucidef_add_switch_vlan "switch0" "2" "0t 1"
226 ucidef_set_interfaces_lan_wan "eth0" "eth1"
227 ucidef_add_switch "switch0" "1" "1"
228 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
232 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
233 ucidef_add_switch "switch0" "1" "1"
234 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
239 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
240 ucidef_add_switch "switch0" "1" "1"
241 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
242 ucidef_add_switch_vlan "switch0" "2" "0t 5"
243 mac=$(mtd_get_mac_ascii nvram "^wan_mac")
244 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
249 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
250 ucidef_add_switch "switch0" "1" "1"
251 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
252 ucidef_add_switch_vlan "switch0" "2" "0t 5"
253 mac=$(mtd_get_mac_ascii devdata "wanmac")
254 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
260 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
261 ucidef_add_switch "switch0" "1" "1"
262 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
263 ucidef_add_switch_vlan "switch0" "2" "0t 5"
264 mac_lan=$(mtd_get_mac_binary caldata 0)
265 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
266 mac_wan=$(mtd_get_mac_binary caldata 6)
267 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
272 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
273 ucidef_add_switch "switch0" "1" "1"
274 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
275 ucidef_add_switch_vlan "switch0" "2" "0t 5"
276 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
277 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
313 ucidef_set_interface_lan "eth0"
317 ucidef_set_interface_lan "eth1"
331 ucidef_set_interfaces_lan_wan "eth1" "eth0"
362 ucidef_set_interfaces_lan_wan "eth0" "eth1"
363 ucidef_add_switch "switch0" "1" "1"
364 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
368 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
369 ucidef_add_switch "switch0" "1" "1"
370 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
371 ucidef_add_switch_vlan "switch0" "2" "0t 1"
375 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
376 ucidef_add_switch "switch0" "1" "1"
377 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
378 ucidef_add_switch_vlan "switch0" "2" "0t 3"
382 ucidef_set_interfaces_lan_wan "eth0" "eth1"
383 ucidef_add_switch "switch0" "1" "1"
384 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
388 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
389 ucidef_add_switch "switch0" "1" "1"
390 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
391 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
392 uci set network.@switch[-1].blinkrate='2'
394 ucidef_add_switch_port "switch0" "1"
395 # Port 1 controls the GREEN configuration of LEDs for
396 # the switch and the section does not correspond to a real
399 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
400 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
401 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
402 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
403 # 14: Link (master); 15: separate register
404 uci set network.@switch_port[-1].led='6'
406 ucidef_add_switch_port "switch0" "2"
407 # Port 2 controls the ORANGE configuration of LEDs for
408 # the switch and the section does not correspond to a real
411 # See the key above for switch port 1 for the meaning of the
412 # 'led' setting below.
413 uci set network.@switch_port[-1].led='9'
415 ucidef_add_switch_port "switch0" "5"
416 # Port 5 controls the configuration of the WAN LED and the
417 # section does not correspond to a real switch port.
419 # To toggle the use of green or orange LEDs for the WAN port,
420 # see the LED setting for wndr3700:green:wan in /etc/config/system.
422 # See the key above for switch port 1 for the meaning of the
423 # 'led' setting below.
424 uci set network.@switch_port[-1].led='2'
428 ucidef_set_interfaces_lan_wan "eth0" "eth1"