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:wan $wanports"
24 lanports
="$port:lan $lanports"
27 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
28 ucidef_add_switch
"rt305x" $lanports $wanports "6@eth0"
31 ramips_setup_interfaces
()
35 ucidef_set_interface_loopback
54 ucidef_add_switch
"switch0"
55 ucidef_add_switch_attr
"switch0" "reset" "false"
56 ucidef_set_interface_lan
"eth0"
61 ucidef_set_interface_lan
"eth0.2"
89 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
90 ucidef_add_switch
"switch0" \
91 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
94 ucidef_set_interface_lan
"eth0.1"
95 ucidef_add_switch
"switch0" \
102 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
103 ucidef_add_switch
"switch0" \
104 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
109 ucidef_set_interface_lan
"eth0.1"
110 ucidef_add_switch
"switch0" \
111 "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
126 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
127 ucidef_add_switch
"switch0" \
128 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
131 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
132 ucidef_add_switch
"switch0" \
133 "0:lan" "1:wan" "6@eth0"
142 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
145 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
146 ucidef_add_switch
"switch0" \
147 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
150 ucidef_set_interface_lan
"eth0.1"
151 ucidef_add_switch
"switch0" \
155 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
156 ucidef_add_switch
"switch0" \
157 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
163 ucidef_set_interface_lan
"eth0"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch1" \
169 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
173 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
174 ucidef_add_switch
"switch0" \
175 "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
178 ucidef_add_switch
"switch0"
179 ucidef_add_switch_attr
"switch0" "reset" "false"
180 ucidef_set_interface_lan
"eth0"
186 ucidef_set_interface_lan
"eth0.1"
190 ucidef_set_interface_lan
"eth0.1"
191 ucidef_add_switch
"switch0" \
192 "0:lan" "4:lan" "6t@eth0"
195 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
196 ucidef_add_switch
"switch0" \
197 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
201 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
202 ucidef_add_switch
"switch0" \
203 "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
207 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
208 ucidef_add_switch
"switch0" \
209 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
212 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
213 ucidef_add_switch
"switch0" \
217 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
218 ucidef_add_switch
"switch0" \
219 "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
222 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
223 ucidef_add_switch
"switch0" \
224 "1:lan" "2:lan" "0:wan" "6@eth0"
227 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
228 ucidef_add_switch
"switch0" \
229 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
232 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
233 if [ -n "${RT3X5X}" ]; then
234 ramips_setup_rt3x5x_vlans
236 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
265 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
266 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
267 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
274 wan_mac
=$
(mtd_get_mac_binary factory
46)
277 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
278 wan_mac
=$
(mtd_get_mac_binary devdata
7)
282 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
283 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
286 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
289 lan_mac
=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
290 [ -n "$lan_mac" ] || lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
291 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
294 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
298 wan_mac
=$
(mtd_get_mac_binary factory
4)
299 lan_mac
=$
(mtd_get_mac_binary factory
46)
305 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
306 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
309 lan_mac
=$
(mtd_get_mac_binary factory
40)
310 wan_mac
=$
(mtd_get_mac_binary factory
46)
313 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
314 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
315 wan_mac
=$
(mtd_get_mac_binary factory
32772)
318 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
319 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
322 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
323 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
326 lan_mac
=$
(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR
)
327 wan_mac
=$
(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR
)
330 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
331 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
334 wan_mac
=$
(mtd_get_mac_binary factory
40)
340 wan_mac
=$
(mtd_get_mac_binary factory
4)
344 lan_mac
=$
(mtd_get_mac_binary factory
4)
345 wan_mac
=$
(mtd_get_mac_binary factory
40)
348 local index
="$(find_mtd_index "board_data
")"
349 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
353 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
354 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
358 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
359 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
363 board
=$
(ramips_board_name
)
364 ramips_setup_interfaces
$board
365 ramips_setup_macs
$board