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
49 ucidef_add_switch
"switch0" "1" "0"
50 ucidef_set_interface_lan
"eth0"
55 ucidef_set_interface_lan
"eth0.2"
61 ucidef_set_interface_lan
"eth0.1"
70 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
74 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
75 ucidef_add_switch
"switch0" "1" "1"
76 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
77 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
81 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
82 ucidef_add_switch
"switch0" "1" "1"
83 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
84 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
88 ucidef_set_interface_lan
"eth0.1"
89 ucidef_add_switch
"switch0" "1" "1"
90 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
94 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
95 ucidef_add_switch
"switch0" "1" "1"
96 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
97 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
101 ucidef_set_interface_lan
"eth0.1"
102 ucidef_add_switch
"switch0" "1" "1"
103 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
114 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
115 ucidef_add_switch
"switch0" "1" "1"
116 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
117 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" "1 2 3 4 6t"
134 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
138 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 5t"
146 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
152 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
153 ucidef_add_switch
"switch0" "1" "1"
154 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
155 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
159 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
160 ucidef_add_switch
"switch0" "1" "1"
161 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
162 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch0" "1" "1"
169 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
170 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
174 ucidef_set_interface_lan
"eth0.1"
175 ucidef_add_switch
"switch0" "1" "1"
176 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
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 6t"
183 ucidef_add_switch_vlan
"switch0" "2" "6t"
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 4 6t"
190 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
195 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
196 ucidef_add_switch
"switch0" "1" "1"
197 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
198 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
204 ucidef_set_interface_lan
"eth0"
208 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
209 if [ -n "${RT3X5X}" ]; then
210 ramips_setup_rt3x5x_vlans
212 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
226 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
227 wan_mac
=$
(mtd_get_mac_binary devdata
7)
231 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
232 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
236 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
237 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
241 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
242 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
249 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
250 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
269 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
270 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
271 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
276 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
277 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
281 wan_mac
=$
(mtd_get_mac_binary factory
40)
285 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
286 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
287 wan_mac
=$
(mtd_get_mac_binary factory
32772)
295 wan_mac
=$
(mtd_get_mac_binary factory
46)
299 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
300 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
305 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
306 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
310 board
=$
(ramips_board_name
)
311 ramips_setup_interfaces
$board
312 ramips_setup_macs
$board