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"
59 ucidef_add_switch
"switch0" "1" "0"
60 ucidef_set_interface_lan
"eth0"
65 ucidef_set_interface_lan
"eth0.2"
68 ucidef_set_interface_lan
"eth0.1"
72 ucidef_add_switch
"switch0" "4"
73 ucidef_set_interface_lan
"eth0"
79 ucidef_set_interface_lan
"eth0.1"
88 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
92 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
93 ucidef_add_switch
"switch0" "1" "1"
94 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
95 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
99 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
100 ucidef_add_switch
"switch0" "1" "1"
101 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
102 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
106 ucidef_set_interface_lan
"eth0.1"
107 ucidef_add_switch
"switch0" "1" "1"
108 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
112 ucidef_set_interface_lan
"eth0.1"
113 ucidef_add_switch
"switch0" "1" "1"
114 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
118 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
121 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
141 xiaomi-miwifi-mini |\
143 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
144 ucidef_add_switch
"switch0" "1" "1"
145 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
146 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
150 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
151 ucidef_add_switch
"switch0" "1" "1"
152 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
153 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
169 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
170 ucidef_add_switch
"switch0" "1" "1"
171 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
172 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
176 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
181 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
182 ucidef_add_switch
"switch0" "1" "1"
183 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
184 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
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 1 2 3 5t"
194 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
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 8t"
201 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
206 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
207 ucidef_add_switch
"switch0" "1" "1"
208 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
209 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
213 ucidef_set_interface_lan
"eth0.1"
214 ucidef_add_switch
"switch0" "1" "1"
215 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
219 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
220 ucidef_add_switch
"switch0" "1" "1"
221 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
222 ucidef_add_switch_vlan
"switch0" "2" "6t"
226 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
227 ucidef_add_switch
"switch0" "1" "1"
228 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
229 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
233 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
234 ucidef_add_switch
"switch0" "1" "1"
235 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
236 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
242 ucidef_set_interface_lan
"eth0"
247 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
248 ucidef_add_switch
"switch1" "1" "1"
249 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
250 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
254 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
255 ucidef_add_switch
"switch0" "1" "1"
256 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
257 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
260 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
261 if [ -n "${RT3X5X}" ]; then
262 ramips_setup_rt3x5x_vlans
264 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
278 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
279 wan_mac
=$
(mtd_get_mac_binary devdata
7)
283 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
284 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
288 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
289 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
293 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
294 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
301 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
302 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
321 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
322 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
323 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
327 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
332 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
333 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
337 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
341 wan_mac
=$
(mtd_get_mac_binary factory
40)
345 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
346 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
347 wan_mac
=$
(mtd_get_mac_binary factory
32772)
355 wan_mac
=$
(mtd_get_mac_binary factory
46)
359 wan_mac
=$
(mtd_get_mac_binary factory
4)
363 local index
="$(find_mtd_index "board_data
")"
364 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
368 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
369 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
374 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
375 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
379 board
=$
(ramips_board_name
)
380 ramips_setup_interfaces
$board
381 ramips_setup_macs
$board