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"
69 ucidef_add_switch
"switch0" "4"
70 ucidef_set_interface_lan
"eth0"
76 ucidef_set_interface_lan
"eth0.1"
85 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
89 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
90 ucidef_add_switch
"switch0" "1" "1"
91 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
92 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
96 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
97 ucidef_add_switch
"switch0" "1" "1"
98 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
99 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
103 ucidef_set_interface_lan
"eth0.1"
104 ucidef_add_switch
"switch0" "1" "1"
105 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
109 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
110 ucidef_add_switch
"switch0" "1" "1"
111 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
112 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
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 1 2 3 6t"
135 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
139 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
140 ucidef_add_switch
"switch0" "1" "1"
141 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
142 ucidef_add_switch_vlan
"switch0" "2" "5 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" "1 2 3 4 6t"
161 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
165 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
170 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
171 ucidef_add_switch
"switch0" "1" "1"
172 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
173 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
180 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
181 ucidef_add_switch
"switch0" "1" "1"
182 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
183 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
187 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
188 ucidef_add_switch
"switch0" "1" "1"
189 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
190 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
195 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
196 ucidef_add_switch
"switch0" "1" "1"
197 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
198 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
202 ucidef_set_interface_lan
"eth0.1"
203 ucidef_add_switch
"switch0" "1" "1"
204 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
208 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
209 ucidef_add_switch
"switch0" "1" "1"
210 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
211 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 4 6t"
218 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
222 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
223 ucidef_add_switch
"switch0" "1" "1"
224 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
225 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
231 ucidef_set_interface_lan
"eth0"
236 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
237 ucidef_add_switch
"switch1" "1" "1"
238 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
239 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
243 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
244 if [ -n "${RT3X5X}" ]; then
245 ramips_setup_rt3x5x_vlans
247 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
261 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
262 wan_mac
=$
(mtd_get_mac_binary devdata
7)
266 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
267 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
271 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
272 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
276 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
277 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
284 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
285 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
304 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
305 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
306 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
310 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
315 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
316 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
320 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
324 wan_mac
=$
(mtd_get_mac_binary factory
40)
328 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
329 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
330 wan_mac
=$
(mtd_get_mac_binary factory
32772)
338 wan_mac
=$
(mtd_get_mac_binary factory
46)
342 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
343 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
348 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
349 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
353 board
=$
(ramips_board_name
)
354 ramips_setup_interfaces
$board
355 ramips_setup_macs
$board