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"
57 ucidef_add_switch
"switch0" "1" "0"
58 ucidef_set_interface_lan
"eth0"
63 ucidef_set_interface_lan
"eth0.2"
66 ucidef_set_interface_lan
"eth0.1"
70 ucidef_add_switch
"switch0" "4"
71 ucidef_set_interface_lan
"eth0"
77 ucidef_set_interface_lan
"eth0.1"
86 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
90 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
91 ucidef_add_switch
"switch0" "1" "1"
92 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
93 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
97 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
98 ucidef_add_switch
"switch0" "1" "1"
99 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
100 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
104 ucidef_set_interface_lan
"eth0.1"
105 ucidef_add_switch
"switch0" "1" "1"
106 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
110 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
111 ucidef_add_switch
"switch0" "1" "1"
112 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
113 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
133 xiaomi-miwifi-mini |\
135 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
136 ucidef_add_switch
"switch0" "1" "1"
137 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
138 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" "0 1 2 3 6t"
145 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
161 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
162 ucidef_add_switch
"switch0" "1" "1"
163 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
164 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
168 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
173 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
174 ucidef_add_switch
"switch0" "1" "1"
175 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
176 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
183 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
184 ucidef_add_switch
"switch0" "1" "1"
185 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
186 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
190 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
191 ucidef_add_switch
"switch0" "1" "1"
192 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
193 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
198 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
199 ucidef_add_switch
"switch0" "1" "1"
200 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
201 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
205 ucidef_set_interface_lan
"eth0.1"
206 ucidef_add_switch
"switch0" "1" "1"
207 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
211 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
212 ucidef_add_switch
"switch0" "1" "1"
213 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
214 ucidef_add_switch_vlan
"switch0" "2" "6t"
218 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
219 ucidef_add_switch
"switch0" "1" "1"
220 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
221 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
225 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
226 ucidef_add_switch
"switch0" "1" "1"
227 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
228 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
234 ucidef_set_interface_lan
"eth0"
239 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
240 ucidef_add_switch
"switch1" "1" "1"
241 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
242 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
246 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
247 if [ -n "${RT3X5X}" ]; then
248 ramips_setup_rt3x5x_vlans
250 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
264 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
265 wan_mac
=$
(mtd_get_mac_binary devdata
7)
269 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
270 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
274 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
275 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
279 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
280 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
287 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
288 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
307 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
308 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
309 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
313 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
318 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
319 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
323 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
327 wan_mac
=$
(mtd_get_mac_binary factory
40)
331 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
332 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
333 wan_mac
=$
(mtd_get_mac_binary factory
32772)
341 wan_mac
=$
(mtd_get_mac_binary factory
46)
345 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
346 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
351 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
352 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
356 board
=$
(ramips_board_name
)
357 ramips_setup_interfaces
$board
358 ramips_setup_macs
$board