5 .
/lib
/functions
/uci-defaults-new.sh
6 .
/lib
/functions
/system.sh
8 ramips_setup_rt3x5x_vlans
()
10 if [ ! -x /sbin
/swconfig
]; then
12 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
17 for port
in 5 4 3 2 1 0; do
18 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
21 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
22 wanports
="$port $wanports"
24 lanports
="$port $lanports"
27 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
28 ucidef_add_switch
"rt305x" "1" "1"
29 ucidef_add_switch_vlan
"rt305x" "1" "$lanports 6t"
30 ucidef_add_switch_vlan
"rt305x" "2" "$wanports 6t"
33 ramips_setup_interfaces
()
37 ucidef_set_interface_loopback
56 ucidef_add_switch
"switch0" "1" "0"
57 ucidef_set_interface_lan
"eth0"
62 ucidef_set_interface_lan
"eth0.2"
87 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
88 ucidef_add_switch
"switch0" "1" "1"
89 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
90 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
93 ucidef_set_interface_lan
"eth0.1"
94 ucidef_add_switch
"switch0" "1" "1"
95 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
101 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
102 ucidef_add_switch
"switch0" "1" "1"
103 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
104 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
109 ucidef_set_interface_lan
"eth0.1"
110 ucidef_add_switch
"switch0" "1" "1"
111 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
126 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
127 ucidef_add_switch
"switch0" "1" "1"
128 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
129 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
132 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
135 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
144 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
147 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
148 ucidef_add_switch
"switch0" "1" "1"
149 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
150 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
153 ucidef_set_interface_lan
"eth0.1"
154 ucidef_add_switch
"switch0" "1" "1"
155 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
158 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
159 ucidef_add_switch
"switch0" "1" "1"
160 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
161 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
167 ucidef_set_interface_lan
"eth0"
171 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
172 ucidef_add_switch
"switch1" "1" "1"
173 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
174 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
178 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
179 ucidef_add_switch
"switch0" "1" "1"
180 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
181 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
184 ucidef_add_switch
"switch0" "4"
185 ucidef_set_interface_lan
"eth0"
191 ucidef_set_interface_lan
"eth0.1"
195 ucidef_set_interface_lan
"eth0.1"
196 ucidef_add_switch
"switch0" "1" "1"
197 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
200 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
201 ucidef_add_switch
"switch0" "1" "1"
202 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
203 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
207 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
208 ucidef_add_switch
"switch0" "1" "1"
209 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
210 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
214 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
215 ucidef_add_switch
"switch0" "1" "1"
216 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
217 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
220 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
221 ucidef_add_switch
"switch0" "1" "1"
222 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
223 ucidef_add_switch_vlan
"switch0" "2" "6t"
226 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
227 ucidef_add_switch
"switch0" "1" "1"
228 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
229 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
232 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
233 ucidef_add_switch
"switch0" "1" "1"
234 ucidef_add_switch_vlan
"switch0" "1" "1 2 6t"
235 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
238 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
239 ucidef_add_switch
"switch0" "1" "1"
240 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
241 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
244 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
245 if [ -n "${RT3X5X}" ]; then
246 ramips_setup_rt3x5x_vlans
248 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
277 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
278 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
279 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
286 wan_mac
=$
(mtd_get_mac_binary factory
46)
289 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
290 wan_mac
=$
(mtd_get_mac_binary devdata
7)
294 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
295 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
298 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
301 lan_mac
=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
302 [ -n "$lan_mac" ] || lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
303 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
306 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
310 wan_mac
=$
(mtd_get_mac_binary factory
4)
311 lan_mac
=$
(mtd_get_mac_binary factory
46)
317 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
318 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
321 lan_mac
=$
(mtd_get_mac_binary factory
40)
322 wan_mac
=$
(mtd_get_mac_binary factory
46)
325 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
326 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
327 wan_mac
=$
(mtd_get_mac_binary factory
32772)
330 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
331 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
334 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
335 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
338 lan_mac
=$
(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR
)
339 wan_mac
=$
(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR
)
342 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
343 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
346 wan_mac
=$
(mtd_get_mac_binary factory
40)
352 wan_mac
=$
(mtd_get_mac_binary factory
4)
356 lan_mac
=$
(mtd_get_mac_binary factory
4)
357 wan_mac
=$
(mtd_get_mac_binary factory
40)
360 local index
="$(find_mtd_index "board_data
")"
361 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
365 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
366 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
370 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
371 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
375 board
=$
(ramips_board_name
)
376 ramips_setup_interfaces
$board
377 ramips_setup_macs
$board