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
54 ucidef_add_switch
"switch0" "1" "0"
55 ucidef_set_interface_lan
"eth0"
60 ucidef_set_interface_lan
"eth0.2"
84 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
85 ucidef_add_switch
"switch0" "1" "1"
86 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
87 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
90 ucidef_set_interface_lan
"eth0.1"
91 ucidef_add_switch
"switch0" "1" "1"
92 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
98 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
99 ucidef_add_switch
"switch0" "1" "1"
100 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
101 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
105 ucidef_set_interface_lan
"eth0.1"
106 ucidef_add_switch
"switch0" "1" "1"
107 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
122 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
123 ucidef_add_switch
"switch0" "1" "1"
124 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
125 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
128 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
129 ucidef_add_switch
"switch0" "1" "1"
130 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
131 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
140 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
143 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
144 ucidef_add_switch
"switch0" "1" "1"
145 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
146 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
149 ucidef_set_interface_lan
"eth0.1"
150 ucidef_add_switch
"switch0" "1" "1"
151 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
154 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
155 ucidef_add_switch
"switch0" "1" "1"
156 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
157 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
163 ucidef_set_interface_lan
"eth0"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch1" "1" "1"
169 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
170 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
173 ucidef_add_switch
"switch0" "4"
174 ucidef_set_interface_lan
"eth0"
180 ucidef_set_interface_lan
"eth0.1"
184 ucidef_set_interface_lan
"eth0.1"
185 ucidef_add_switch
"switch0" "1" "1"
186 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
189 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
190 ucidef_add_switch
"switch0" "1" "1"
191 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
192 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
196 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
197 ucidef_add_switch
"switch0" "1" "1"
198 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
199 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
203 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
204 ucidef_add_switch
"switch0" "1" "1"
205 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
206 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
209 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
210 ucidef_add_switch
"switch0" "1" "1"
211 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
212 ucidef_add_switch_vlan
"switch0" "2" "6t"
215 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
216 ucidef_add_switch
"switch0" "1" "1"
217 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
218 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
221 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
222 ucidef_add_switch
"switch0" "1" "1"
223 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
224 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
227 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
228 ucidef_add_switch
"switch0" "1" "1"
229 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
230 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
233 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
234 if [ -n "${RT3X5X}" ]; then
235 ramips_setup_rt3x5x_vlans
237 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
266 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
267 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
268 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
275 wan_mac
=$
(mtd_get_mac_binary factory
46)
278 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
279 wan_mac
=$
(mtd_get_mac_binary devdata
7)
283 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
284 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
287 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
290 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
296 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
297 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
300 lan_mac
=$
(mtd_get_mac_binary factory
40)
301 wan_mac
=$
(mtd_get_mac_binary factory
46)
304 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
305 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
306 wan_mac
=$
(mtd_get_mac_binary factory
32772)
309 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
310 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
313 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
314 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
317 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
318 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
321 wan_mac
=$
(mtd_get_mac_binary factory
40)
327 wan_mac
=$
(mtd_get_mac_binary factory
4)
331 local index
="$(find_mtd_index "board_data
")"
332 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
336 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
337 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
341 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
342 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
346 board
=$
(ramips_board_name
)
347 ramips_setup_interfaces
$board
348 ramips_setup_macs
$board