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"
50 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
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"
60 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
61 ucidef_add_switch
"switch0" "1" "1"
62 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
63 ucidef_add_switch_vlan
"switch0" "2" "5 6"
69 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
70 ucidef_add_switch
"switch0" "1" "1"
71 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
72 ucidef_add_switch_vlan
"switch0" "2" "1 6"
76 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
77 ucidef_add_switch
"switch0" "1" "1"
78 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
79 ucidef_set_interface_wlan
83 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
84 ucidef_add_switch
"switch0" "1" "1"
85 ucidef_add_switch_vlan
"switch0" "1" "0t 5"
86 ucidef_add_switch_vlan
"switch0" "2" "0t 4"
90 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
91 ucidef_add_switch
"switch0" "1" "1"
92 ucidef_add_switch_vlan
"switch0" "1" "0t 4"
93 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
102 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
103 ucidef_add_switch
"switch0" "1" "1"
104 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
105 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
106 ucidef_add_switch
"switch1" "1" "1"
107 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
110 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
111 ucidef_set_interface_raw
"sfp" "eth0.3"
112 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
119 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
120 ucidef_add_switch
"switch0" "1" "1"
121 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
125 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
126 ucidef_add_switch
"switch0" "1" "1"
127 ucidef_add_switch_vlan
"switch0" "1" "2 3 4 5 6"
128 ucidef_add_switch_vlan
"switch0" "2" "0 1"
132 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
138 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
139 ucidef_add_switch
"switch0" "1" "1"
140 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
141 ucidef_add_switch_vlan
"switch0" "2" "5 6"
146 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
147 ucidef_add_switch
"switch0" "1" "1"
148 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
152 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
153 ucidef_add_switch
"switch0" "1" "1"
154 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
158 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
159 ucidef_add_switch
"switch0" "1" "1"
160 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
165 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
166 ucidef_add_switch
"switch0" "1" "1"
167 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
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
"eth1" "eth0"
186 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
187 ucidef_add_switch
"switch0" "1" "1"
188 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
189 ucidef_add_switch
"switch1" "1" "1"
190 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
191 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
197 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
200 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
204 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
205 ucidef_add_switch
"switch0" "1" "1"
206 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
211 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
212 ucidef_add_switch
"switch0" "1" "1"
213 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
214 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
218 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
219 ucidef_add_switch
"switch0" "1" "1"
220 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
221 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
225 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
226 ucidef_add_switch
"switch0" "1" "1"
227 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
228 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
233 ucidef_set_interface_raw
"eth" "eth0"
234 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
250 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
251 ucidef_add_switch
"switch0" "1" "1"
252 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
256 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
257 ucidef_add_switch
"switch0" "1" "1"
258 ucidef_add_switch_vlan
"switch0" "1" "0t 1"
259 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
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 5"
266 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
270 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
271 ucidef_add_switch
"switch0" "1" "1"
272 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
276 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
277 ucidef_add_switch
"switch0" "1" "1"
278 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
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
=$
(mtd_get_mac_ascii nvram
"wan_mac")
289 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
294 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
295 ucidef_add_switch
"switch0" "1" "1"
296 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
297 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
298 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
299 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
303 ucidef_set_interface_lan
"wlan0"
310 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
311 ucidef_add_switch
"switch0" "1" "1"
312 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
313 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
314 mac_lan
=$
(mtd_get_mac_binary caldata
0)
315 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
316 mac_wan
=$
(mtd_get_mac_binary caldata
6)
317 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
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 1 2 3 4"
325 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
326 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
327 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
331 ucidef_set_interface_lan
"eth0 eth1"
335 ucidef_set_interface_lan
"eth0"
336 ucidef_add_switch
"switch0" "1" "0"
337 ucidef_add_switch_vlan
"switch0" "0" "0 2 3 4"
383 ucidef_set_interface_lan
"eth0"
389 ucidef_set_interface_lan
"eth1"
403 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
407 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
408 ucidef_add_switch
"switch0" "1" "1"
409 ucidef_add_switch_vlan
"switch0" "1" "0t 3"
410 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
414 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
418 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
419 ucidef_add_switch
"switch0" "1" "1"
420 ucidef_add_switch_vlan
"switch0" "1" "5 6t"
421 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
456 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
457 ucidef_add_switch
"switch0" "1" "1"
458 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
462 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
463 ucidef_add_switch
"switch0" "1" "1"
464 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
465 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
469 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
470 ucidef_add_switch
"switch0" "1" "1"
471 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
472 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
476 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
477 ucidef_add_switch
"switch0" "1" "1"
478 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
482 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
483 ucidef_add_switch
"switch0" "1" "1"
484 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
485 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
486 uci
set network.@switch
[-1].blinkrate
='2'
488 ucidef_add_switch_port
"switch0" "1"
489 # Port 1 controls the GREEN configuration of LEDs for
490 # the switch and the section does not correspond to a real
493 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
494 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
495 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
496 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
497 # 14: Link (master); 15: separate register
498 uci
set network.@switch_port
[-1].led
='6'
500 ucidef_add_switch_port
"switch0" "2"
501 # Port 2 controls the ORANGE configuration of LEDs for
502 # the switch and the section does not correspond to a real
505 # See the key above for switch port 1 for the meaning of the
506 # 'led' setting below.
507 uci
set network.@switch_port
[-1].led
='9'
509 ucidef_add_switch_port
"switch0" "5"
510 # Port 5 controls the configuration of the WAN LED and the
511 # section does not correspond to a real switch port.
513 # To toggle the use of green or orange LEDs for the WAN port,
514 # see the LED setting for wndr3700:green:wan in /etc/config/system.
516 # See the key above for switch port 1 for the meaning of the
517 # 'led' setting below.
518 uci
set network.@switch_port
[-1].led
='2'
522 ucidef_set_interfaces_lan_wan
"eth0" "eth1"