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"
55 ucidef_add_switch
"switch0" "1" "0"
56 ucidef_set_interface_lan
"eth0"
61 ucidef_set_interface_lan
"eth0.2"
67 ucidef_set_interface_lan
"eth0.1"
76 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
80 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
81 ucidef_add_switch
"switch0" "1" "1"
82 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
83 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
87 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
88 ucidef_add_switch
"switch0" "1" "1"
89 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
90 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
94 ucidef_set_interface_lan
"eth0.1"
95 ucidef_add_switch
"switch0" "1" "1"
96 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
100 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
101 ucidef_add_switch
"switch0" "1" "1"
102 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
103 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
107 ucidef_set_interface_lan
"eth0.1"
108 ucidef_add_switch
"switch0" "1" "1"
109 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
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"
142 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
143 ucidef_add_switch
"switch0" "1" "1"
144 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
145 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
149 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
154 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
155 ucidef_add_switch
"switch0" "1" "1"
156 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
157 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
163 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
164 ucidef_add_switch
"switch0" "1" "1"
165 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
166 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
170 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
171 ucidef_add_switch
"switch0" "1" "1"
172 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
173 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
178 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
179 ucidef_add_switch
"switch0" "1" "1"
180 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
181 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
185 ucidef_set_interface_lan
"eth0.1"
186 ucidef_add_switch
"switch0" "1" "1"
187 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
191 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
192 ucidef_add_switch
"switch0" "1" "1"
193 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
194 ucidef_add_switch_vlan
"switch0" "2" "6t"
198 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
199 ucidef_add_switch
"switch0" "1" "1"
200 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
201 ucidef_add_switch_vlan
"switch0" "2" "4 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" "1 2 3 4 5 6t"
209 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
215 ucidef_set_interface_lan
"eth0"
219 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
220 ucidef_add_switch
"switch1" "1" "1"
221 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
222 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
226 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
227 if [ -n "${RT3X5X}" ]; then
228 ramips_setup_rt3x5x_vlans
230 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
244 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
245 wan_mac
=$
(mtd_get_mac_binary devdata
7)
249 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
250 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
254 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
255 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
259 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
260 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
267 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
268 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
288 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
289 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
290 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
295 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
296 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
300 wan_mac
=$
(mtd_get_mac_binary factory
40)
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)
314 wan_mac
=$
(mtd_get_mac_binary factory
46)
318 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
319 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
324 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
325 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
329 board
=$
(ramips_board_name
)
330 ramips_setup_interfaces
$board
331 ramips_setup_macs
$board