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
)
23 ucidef_set_interface_lan
"eth0 eth1"
28 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
29 ucidef_add_switch
"switch0" "1" "1"
30 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
31 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
36 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
37 ucidef_add_switch
"switch0" "1" "1"
38 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
39 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
43 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
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"
53 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
54 ucidef_add_switch
"switch0" "1" "1"
55 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
56 ucidef_add_switch_vlan
"switch0" "2" "5 6"
62 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
63 ucidef_add_switch
"switch0" "1" "1"
64 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
65 ucidef_add_switch_vlan
"switch0" "2" "1 6"
69 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
70 ucidef_add_switch
"switch0" "1" "1"
71 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
72 ucidef_add_switch_vlan
"switch0" "2" "0t 4"
81 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
82 ucidef_add_switch
"switch0" "1" "1"
83 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
84 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
85 ucidef_add_switch
"switch1" "1" "1"
86 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
89 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
90 ucidef_set_interface_raw
"sfp" "eth0.3"
91 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
98 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
99 ucidef_add_switch
"switch0" "1" "1"
100 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
104 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
105 ucidef_add_switch
"switch0" "1" "1"
106 ucidef_add_switch_vlan
"switch0" "1" "2 3 4 5 6"
107 ucidef_add_switch_vlan
"switch0" "2" "0 1"
111 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
112 ucidef_add_switch
"switch0" "1" "1"
113 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
117 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
118 ucidef_add_switch
"switch0" "1" "1"
119 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
120 ucidef_add_switch_vlan
"switch0" "2" "5 6"
125 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
126 ucidef_add_switch
"switch0" "1" "1"
127 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
131 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
132 ucidef_add_switch
"switch0" "1" "1"
133 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
137 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
138 ucidef_add_switch
"switch0" "1" "1"
139 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
144 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
145 ucidef_add_switch
"switch0" "1" "1"
146 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
154 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
155 ucidef_add_switch
"switch0" "1" "1"
156 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
157 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
161 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
165 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
166 ucidef_add_switch
"switch0" "1" "1"
167 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
168 ucidef_add_switch
"switch1" "1" "1"
169 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
170 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
176 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
177 ucidef_add_switch
"switch0" "1" "1"
178 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
179 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
183 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
184 ucidef_add_switch
"switch0" "1" "1"
185 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
190 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
191 ucidef_add_switch
"switch0" "1" "1"
192 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
193 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
197 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
200 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
204 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
205 ucidef_add_switch
"switch0" "1" "1"
206 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
207 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
212 ucidef_set_interface_raw
"eth" "eth0"
213 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
228 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
229 ucidef_add_switch
"switch0" "1" "1"
230 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
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"
237 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
241 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
242 ucidef_add_switch
"switch0" "1" "1"
243 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
244 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
248 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
249 ucidef_add_switch
"switch0" "1" "1"
250 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
254 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
255 ucidef_add_switch
"switch0" "1" "1"
256 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
262 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
263 ucidef_add_switch
"switch0" "1" "1"
264 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
265 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
266 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
267 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
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 devdata
"wanmac")
277 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
284 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
285 ucidef_add_switch
"switch0" "1" "1"
286 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
287 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
288 mac_lan
=$
(mtd_get_mac_binary caldata
0)
289 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
290 mac_wan
=$
(mtd_get_mac_binary caldata
6)
291 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
296 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
297 ucidef_add_switch
"switch0" "1" "1"
298 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
299 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
300 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
301 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
347 ucidef_set_interface_lan
"eth0"
353 ucidef_set_interface_lan
"eth1"
367 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
371 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
372 ucidef_add_switch
"switch0" "1" "1"
373 ucidef_add_switch_vlan
"switch0" "1" "0t 3"
374 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
378 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
382 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
383 ucidef_add_switch
"switch0" "1" "1"
384 ucidef_add_switch_vlan
"switch0" "1" "5 6t"
385 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
419 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
420 ucidef_add_switch
"switch0" "1" "1"
421 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
425 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
426 ucidef_add_switch
"switch0" "1" "1"
427 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
428 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
432 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
433 ucidef_add_switch
"switch0" "1" "1"
434 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
435 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
439 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
440 ucidef_add_switch
"switch0" "1" "1"
441 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
445 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
446 ucidef_add_switch
"switch0" "1" "1"
447 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
448 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
449 uci
set network.@switch
[-1].blinkrate
='2'
451 ucidef_add_switch_port
"switch0" "1"
452 # Port 1 controls the GREEN configuration of LEDs for
453 # the switch and the section does not correspond to a real
456 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
457 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
458 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
459 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
460 # 14: Link (master); 15: separate register
461 uci
set network.@switch_port
[-1].led
='6'
463 ucidef_add_switch_port
"switch0" "2"
464 # Port 2 controls the ORANGE configuration of LEDs for
465 # the switch and the section does not correspond to a real
468 # See the key above for switch port 1 for the meaning of the
469 # 'led' setting below.
470 uci
set network.@switch_port
[-1].led
='9'
472 ucidef_add_switch_port
"switch0" "5"
473 # Port 5 controls the configuration of the WAN LED and the
474 # section does not correspond to a real switch port.
476 # To toggle the use of green or orange LEDs for the WAN port,
477 # see the LED setting for wndr3700:green:wan in /etc/config/system.
479 # See the key above for switch port 1 for the meaning of the
480 # 'led' setting below.
481 uci
set network.@switch_port
[-1].led
='2'
485 ucidef_set_interfaces_lan_wan
"eth0" "eth1"