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"
60 ucidef_add_switch
"switch0" "1" "0"
61 ucidef_set_interface_lan
"eth0"
67 ucidef_set_interface_lan
"eth0.2"
70 ucidef_set_interface_lan
"eth0.1"
74 ucidef_add_switch
"switch0" "4"
75 ucidef_set_interface_lan
"eth0"
81 ucidef_set_interface_lan
"eth0.1"
90 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
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 6t"
97 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
101 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
102 ucidef_add_switch
"switch0" "1" "1"
103 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
104 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
109 ucidef_set_interface_lan
"eth0.1"
110 ucidef_add_switch
"switch0" "1" "1"
111 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
115 ucidef_set_interface_lan
"eth0.1"
116 ucidef_add_switch
"switch0" "1" "1"
117 ucidef_add_switch_vlan
"switch0" "1" "4 6t"
121 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
122 ucidef_add_switch
"switch0" "1" "1"
123 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
124 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
147 xiaomi-miwifi-mini |\
149 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
150 ucidef_add_switch
"switch0" "1" "1"
151 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
152 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
156 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
157 ucidef_add_switch
"switch0" "1" "1"
158 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
159 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
175 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
176 ucidef_add_switch
"switch0" "1" "1"
177 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
178 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
182 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
187 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
188 ucidef_add_switch
"switch0" "1" "1"
189 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
190 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
197 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
198 ucidef_add_switch
"switch0" "1" "1"
199 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
200 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
204 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
205 ucidef_add_switch
"switch0" "1" "1"
206 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
207 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
212 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
213 ucidef_add_switch
"switch0" "1" "1"
214 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
215 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
219 ucidef_set_interface_lan
"eth0.1"
220 ucidef_add_switch
"switch0" "1" "1"
221 ucidef_add_switch_vlan
"switch0" "1" "0 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" "0 6t"
228 ucidef_add_switch_vlan
"switch0" "2" "6t"
232 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
233 ucidef_add_switch
"switch0" "1" "1"
234 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
235 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
239 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
240 ucidef_add_switch
"switch0" "1" "1"
241 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
242 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
248 ucidef_set_interface_lan
"eth0"
253 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
254 ucidef_add_switch
"switch1" "1" "1"
255 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
256 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
260 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
261 ucidef_add_switch
"switch0" "1" "1"
262 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
263 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
267 ucidef_set_interface_lan
"eth0.1"
268 ucidef_add_switch
"switch0" "1" "1"
269 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
273 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
274 if [ -n "${RT3X5X}" ]; then
275 ramips_setup_rt3x5x_vlans
277 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
291 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
292 wan_mac
=$
(mtd_get_mac_binary devdata
7)
296 lan_mac
=$
(mtd_get_mac_binary factory
40)
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" 5)
306 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
307 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
311 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
312 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
319 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
320 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
339 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
340 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
341 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
345 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
350 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
351 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
355 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
359 wan_mac
=$
(mtd_get_mac_binary factory
40)
363 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
364 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
365 wan_mac
=$
(mtd_get_mac_binary factory
32772)
373 wan_mac
=$
(mtd_get_mac_binary factory
46)
376 wsr-600|whr-300hp2|whr-600d|whr-1166d
)
377 wan_mac
=$
(mtd_get_mac_binary factory
4)
381 local index
="$(find_mtd_index "board_data
")"
382 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
386 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
387 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
392 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
393 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
397 board
=$
(ramips_board_name
)
398 ramips_setup_interfaces
$board
399 ramips_setup_macs
$board