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
41 ucidef_set_interface_lan
"eth0.1"
42 ucidef_add_switch
"switch0" "1" "1"
43 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
56 ucidef_add_switch
"switch0" "1" "0"
57 ucidef_set_interface_lan
"eth0"
62 ucidef_set_interface_lan
"eth0.2"
68 ucidef_set_interface_lan
"eth0.1"
77 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
81 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
82 ucidef_add_switch
"switch0" "1" "1"
83 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
84 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
88 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
89 ucidef_add_switch
"switch0" "1" "1"
90 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
91 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
95 ucidef_set_interface_lan
"eth0.1"
96 ucidef_add_switch
"switch0" "1" "1"
97 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 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 9t"
104 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
124 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
127 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
131 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
132 ucidef_add_switch
"switch0" "1" "1"
133 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
134 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
149 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
150 ucidef_add_switch
"switch0" "1" "1"
151 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
152 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
156 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
161 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
162 ucidef_add_switch
"switch0" "1" "1"
163 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
164 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
171 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
172 ucidef_add_switch
"switch0" "1" "1"
173 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
174 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
178 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
179 ucidef_add_switch
"switch0" "1" "1"
180 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
181 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
186 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
187 ucidef_add_switch
"switch0" "1" "1"
188 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
189 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
193 ucidef_set_interface_lan
"eth0.1"
194 ucidef_add_switch
"switch0" "1" "1"
195 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
199 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
200 ucidef_add_switch
"switch0" "1" "1"
201 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
202 ucidef_add_switch_vlan
"switch0" "2" "6t"
206 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
207 ucidef_add_switch
"switch0" "1" "1"
208 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
209 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
213 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
214 ucidef_add_switch
"switch0" "1" "1"
215 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
216 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
222 ucidef_set_interface_lan
"eth0"
227 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
228 ucidef_add_switch
"switch1" "1" "1"
229 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
230 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
234 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
235 if [ -n "${RT3X5X}" ]; then
236 ramips_setup_rt3x5x_vlans
238 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
252 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
253 wan_mac
=$
(mtd_get_mac_binary devdata
7)
257 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
258 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
262 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
263 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
267 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
268 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
275 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
276 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
295 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
296 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
297 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
301 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
306 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
307 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
311 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
315 wan_mac
=$
(mtd_get_mac_binary factory
40)
319 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
320 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
321 wan_mac
=$
(mtd_get_mac_binary factory
32772)
329 wan_mac
=$
(mtd_get_mac_binary factory
46)
333 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
334 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
339 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
340 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
344 board
=$
(ramips_board_name
)
345 ramips_setup_interfaces
$board
346 ramips_setup_macs
$board