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"
115 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
116 ucidef_add_switch
"switch0" "1" "1"
117 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
118 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
133 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
134 ucidef_add_switch
"switch0" "1" "1"
135 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
136 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
140 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
145 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
146 ucidef_add_switch
"switch0" "1" "1"
147 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
148 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
154 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
155 ucidef_add_switch
"switch0" "1" "1"
156 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
157 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
161 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
162 ucidef_add_switch
"switch0" "1" "1"
163 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
164 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
169 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
170 ucidef_add_switch
"switch0" "1" "1"
171 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
172 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
176 ucidef_set_interface_lan
"eth0.1"
177 ucidef_add_switch
"switch0" "1" "1"
178 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
182 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
183 ucidef_add_switch
"switch0" "1" "1"
184 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
185 ucidef_add_switch_vlan
"switch0" "2" "6t"
189 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
190 ucidef_add_switch
"switch0" "1" "1"
191 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
192 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
197 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
200 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
206 ucidef_set_interface_lan
"eth0"
210 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
211 if [ -n "${RT3X5X}" ]; then
212 ramips_setup_rt3x5x_vlans
214 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
228 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
229 wan_mac
=$
(mtd_get_mac_binary devdata
7)
233 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
234 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
238 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
239 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
243 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
244 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
251 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
252 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
271 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
272 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
273 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
278 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
279 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
283 wan_mac
=$
(mtd_get_mac_binary factory
40)
287 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
288 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
289 wan_mac
=$
(mtd_get_mac_binary factory
32772)
297 wan_mac
=$
(mtd_get_mac_binary factory
46)
301 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
302 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
307 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
308 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
312 board
=$
(ramips_board_name
)
313 ramips_setup_interfaces
$board
314 ramips_setup_macs
$board