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"
59 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
60 ucidef_add_switch
"switch0" "1" "1"
61 ucidef_add_switch_vlan
"switch0" "1" "0 2 3 4 5"
62 ucidef_add_switch_vlan
"switch0" "2" "1 6"
71 ucidef_set_interfaces_lan_wan
"eth0.1 eth1" "eth0.2"
72 ucidef_add_switch
"switch0" "1" "1"
73 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
74 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
75 ucidef_add_switch
"switch1" "1" "1"
76 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 4 5"
79 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
80 ucidef_set_interface_raw
"sfp" "eth0.3"
81 ucidef_add_switch_vlan
"switch0" "3" "0t 6"
88 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
89 ucidef_add_switch
"switch0" "1" "1"
90 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
94 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
95 ucidef_add_switch
"switch0" "1" "1"
96 ucidef_add_switch_vlan
"switch0" "0" "0 1 2 3 5"
100 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
101 ucidef_add_switch
"switch0" "1" "1"
102 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
103 ucidef_add_switch_vlan
"switch0" "2" "5 6"
108 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
109 ucidef_add_switch
"switch0" "1" "1"
110 ucidef_add_switch_vlan
"switch0" "1" "1 2 5"
114 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
115 ucidef_add_switch
"switch0" "1" "1"
116 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
120 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
121 ucidef_add_switch
"switch0" "1" "1"
122 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5"
127 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
128 ucidef_add_switch
"switch0" "1" "1"
129 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
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 2 3 4 5"
140 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
144 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
148 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
149 ucidef_add_switch
"switch0" "1" "1"
150 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
151 ucidef_add_switch
"switch1" "1" "1"
152 ucidef_add_switch_vlan
"switch1" "1" "0t 1 2 3 4"
153 ucidef_add_switch_vlan
"switch1" "2" "0t 5"
159 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
160 ucidef_add_switch
"switch0" "1" "1"
161 ucidef_add_switch_vlan
"switch0" "1" "0t 1 3 4 5"
162 ucidef_add_switch_vlan
"switch0" "2" "0t 2"
166 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
167 ucidef_add_switch
"switch0" "1" "1"
168 ucidef_add_switch_vlan
"switch0" "1" "0 1 3"
172 ucidef_set_interface_lan
"eth0"
177 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
178 ucidef_add_switch
"switch0" "1" "1"
179 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
180 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
184 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
185 ucidef_add_switch
"switch0" "1" "1"
186 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
187 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
191 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
192 ucidef_add_switch
"switch0" "1" "1"
193 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
194 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
199 ucidef_set_interface_raw
"eth" "eth0"
200 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
210 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
211 ucidef_add_switch
"switch0" "1" "1"
212 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
216 ucidef_set_interface_lan
"eth0"
217 ucidef_add_switch
"switch0" "1" "1"
218 ucidef_add_switch_vlan
"switch0" "1" "0 1 2"
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 5"
225 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
229 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
230 ucidef_add_switch
"switch0" "1" "1"
231 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 5"
235 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
236 ucidef_add_switch
"switch0" "1" "1"
237 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
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 1 2 3 4"
245 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
246 mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
247 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
252 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
253 ucidef_add_switch
"switch0" "1" "1"
254 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
255 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
256 mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
257 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
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_lan
=$
(mtd_get_mac_binary caldata
0)
268 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr
"lan" "$mac_lan"
269 mac_wan
=$
(mtd_get_mac_binary caldata
6)
270 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr
"wan" "$mac_wan"
275 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
276 ucidef_add_switch
"switch0" "1" "1"
277 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
278 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
279 mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
280 [ -n "$mac" ] && ucidef_set_interface_macaddr
"wan" "$mac"
317 ucidef_set_interface_lan
"eth0"
321 ucidef_set_interface_lan
"eth1"
335 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
367 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
368 ucidef_add_switch
"switch0" "1" "1"
369 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4"
373 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
374 ucidef_add_switch
"switch0" "1" "1"
375 ucidef_add_switch_vlan
"switch0" "1" "0t 2 3 4 5"
376 ucidef_add_switch_vlan
"switch0" "2" "0t 1"
380 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
381 ucidef_add_switch
"switch0" "1" "1"
382 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2"
383 ucidef_add_switch_vlan
"switch0" "2" "0t 3"
387 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
388 ucidef_add_switch
"switch0" "1" "1"
389 ucidef_add_switch_vlan
"switch0" "1" "0 2 3"
393 ucidef_set_interfaces_lan_wan
"eth0.1" "eth1"
394 ucidef_add_switch
"switch0" "1" "1"
395 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
396 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
397 uci
set network.@switch
[-1].blinkrate
='2'
399 ucidef_add_switch_port
"switch0" "1"
400 # Port 1 controls the GREEN configuration of LEDs for
401 # the switch and the section does not correspond to a real
404 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
405 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
406 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
407 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
408 # 14: Link (master); 15: separate register
409 uci
set network.@switch_port
[-1].led
='6'
411 ucidef_add_switch_port
"switch0" "2"
412 # Port 2 controls the ORANGE configuration of LEDs for
413 # the switch and the section does not correspond to a real
416 # See the key above for switch port 1 for the meaning of the
417 # 'led' setting below.
418 uci
set network.@switch_port
[-1].led
='9'
420 ucidef_add_switch_port
"switch0" "5"
421 # Port 5 controls the configuration of the WAN LED and the
422 # section does not correspond to a real switch port.
424 # To toggle the use of green or orange LEDs for the WAN port,
425 # see the LED setting for wndr3700:green:wan in /etc/config/system.
427 # See the key above for switch port 1 for the meaning of the
428 # 'led' setting below.
429 uci
set network.@switch_port
[-1].led
='2'
433 ucidef_set_interfaces_lan_wan
"eth0" "eth1"