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"
65 ucidef_set_interface_lan
"eth0.1"
71 ucidef_set_interface_lan
"eth0.1"
80 ucidef_set_interfaces_lan_wan
"eth0.1" "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 6t"
87 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
91 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
92 ucidef_add_switch
"switch0" "1" "1"
93 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
94 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
98 ucidef_set_interface_lan
"eth0.1"
99 ucidef_add_switch
"switch0" "1" "1"
100 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
104 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
105 ucidef_add_switch
"switch0" "1" "1"
106 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
107 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
127 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
128 ucidef_add_switch
"switch0" "1" "1"
129 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
130 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
134 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
135 ucidef_add_switch
"switch0" "1" "1"
136 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
137 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
152 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
153 ucidef_add_switch
"switch0" "1" "1"
154 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
155 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
159 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
164 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
165 ucidef_add_switch
"switch0" "1" "1"
166 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
167 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
174 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
175 ucidef_add_switch
"switch0" "1" "1"
176 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
177 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
181 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
182 ucidef_add_switch
"switch0" "1" "1"
183 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
184 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
189 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
190 ucidef_add_switch
"switch0" "1" "1"
191 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
192 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
196 ucidef_set_interface_lan
"eth0.1"
197 ucidef_add_switch
"switch0" "1" "1"
198 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
202 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
203 ucidef_add_switch
"switch0" "1" "1"
204 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
205 ucidef_add_switch_vlan
"switch0" "2" "6t"
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 1 2 3 4 6t"
212 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
216 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
217 ucidef_add_switch
"switch0" "1" "1"
218 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
219 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
225 ucidef_set_interface_lan
"eth0"
230 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
231 ucidef_add_switch
"switch1" "1" "1"
232 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
233 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
237 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
238 if [ -n "${RT3X5X}" ]; then
239 ramips_setup_rt3x5x_vlans
241 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
255 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
256 wan_mac
=$
(mtd_get_mac_binary devdata
7)
260 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
261 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
265 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
266 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
270 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
271 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
278 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
279 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
298 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
299 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
300 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
304 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
309 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
310 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
314 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
318 wan_mac
=$
(mtd_get_mac_binary factory
40)
322 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
323 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
324 wan_mac
=$
(mtd_get_mac_binary factory
32772)
332 wan_mac
=$
(mtd_get_mac_binary factory
46)
336 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
337 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
342 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
343 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
347 board
=$
(ramips_board_name
)
348 ramips_setup_interfaces
$board
349 ramips_setup_macs
$board