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"
145 xiaomi-miwifi-mini |\
147 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
148 ucidef_add_switch
"switch0" "1" "1"
149 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
150 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
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 6t"
157 ucidef_add_switch_vlan
"switch0" "2" "5 6t"
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 6t"
176 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
180 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
185 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
186 ucidef_add_switch
"switch0" "1" "1"
187 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
188 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
195 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
196 ucidef_add_switch
"switch0" "1" "1"
197 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
198 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
202 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
203 ucidef_add_switch
"switch0" "1" "1"
204 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
205 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
210 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
211 ucidef_add_switch
"switch0" "1" "1"
212 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
213 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
217 ucidef_set_interface_lan
"eth0.1"
218 ucidef_add_switch
"switch0" "1" "1"
219 ucidef_add_switch_vlan
"switch0" "1" "0 4 6t"
223 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
224 ucidef_add_switch
"switch0" "1" "1"
225 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
226 ucidef_add_switch_vlan
"switch0" "2" "6t"
230 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
231 ucidef_add_switch
"switch0" "1" "1"
232 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
233 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
237 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
238 ucidef_add_switch
"switch0" "1" "1"
239 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5 6t"
240 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
246 ucidef_set_interface_lan
"eth0"
251 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
252 ucidef_add_switch
"switch1" "1" "1"
253 ucidef_add_switch_vlan
"switch1" "1" "0 1 2 3 6t"
254 ucidef_add_switch_vlan
"switch1" "2" "4 6t"
258 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
259 ucidef_add_switch
"switch0" "1" "1"
260 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
261 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
264 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
265 if [ -n "${RT3X5X}" ]; then
266 ramips_setup_rt3x5x_vlans
268 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
282 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
283 wan_mac
=$
(mtd_get_mac_binary devdata
7)
287 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
288 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
292 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
293 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
297 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
298 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
305 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
306 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
325 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
326 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
327 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
331 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
336 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
337 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
341 wan_mac
=$
(mtd_get_mac_ascii config WAN_MAC_ADDR
)
345 wan_mac
=$
(mtd_get_mac_binary factory
40)
349 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
350 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
351 wan_mac
=$
(mtd_get_mac_binary factory
32772)
359 wan_mac
=$
(mtd_get_mac_binary factory
46)
362 wsr-600|whr-300hp2|whr-600d|whr-1166d
)
363 wan_mac
=$
(mtd_get_mac_binary factory
4)
367 local index
="$(find_mtd_index "board_data
")"
368 wan_mac
="$(grep -m1 mac= "/dev
/mtd
${index}" | cut -d= -f2)"
372 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
373 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
378 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
379 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
383 board
=$
(ramips_board_name
)
384 ramips_setup_interfaces
$board
385 ramips_setup_macs
$board