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"
58 ucidef_add_switch "switch0" "1" "0"
59 ucidef_set_interface_lan "eth0"
64 ucidef_set_interface_lan "eth0.2"
67 ucidef_set_interface_lan "eth0.1"
71 ucidef_add_switch "switch0" "4"
72 ucidef_set_interface_lan "eth0"
78 ucidef_set_interface_lan "eth0.1"
87 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
91 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
92 ucidef_add_switch "switch0" "1" "1"
93 ucidef_add_switch_vlan "switch0" "1" "0 6t"
94 ucidef_add_switch_vlan "switch0" "2" "1 6t"
98 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
99 ucidef_add_switch "switch0" "1" "1"
100 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
101 ucidef_add_switch_vlan "switch0" "2" "0 9t"
105 ucidef_set_interface_lan "eth0.1"
106 ucidef_add_switch "switch0" "1" "1"
107 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
111 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
112 ucidef_add_switch "switch0" "1" "1"
113 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
114 ucidef_add_switch_vlan "switch0" "2" "4 9t"
134 xiaomi-miwifi-mini |\
136 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
137 ucidef_add_switch "switch0" "1" "1"
138 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
139 ucidef_add_switch_vlan "switch0" "2" "4 6t"
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" "5 6t"
162 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
163 ucidef_add_switch "switch0" "1" "1"
164 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
165 ucidef_add_switch_vlan "switch0" "2" "0 6t"
169 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
174 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
175 ucidef_add_switch "switch0" "1" "1"
176 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
177 ucidef_add_switch_vlan "switch0" "2" "0 5t"
184 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
185 ucidef_add_switch "switch0" "1" "1"
186 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
187 ucidef_add_switch_vlan "switch0" "2" "4 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 8t"
194 ucidef_add_switch_vlan "switch0" "2" "4 8t"
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
200 ucidef_add_switch "switch0" "1" "1"
201 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
202 ucidef_add_switch_vlan "switch0" "2" "0t 5"
206 ucidef_set_interface_lan "eth0.1"
207 ucidef_add_switch "switch0" "1" "1"
208 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
212 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
213 ucidef_add_switch "switch0" "1" "1"
214 ucidef_add_switch_vlan "switch0" "1" "0 6t"
215 ucidef_add_switch_vlan "switch0" "2" "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 1 2 3 4 6t"
222 ucidef_add_switch_vlan "switch0" "2" "4 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" "1 2 3 4 5 6t"
229 ucidef_add_switch_vlan "switch0" "2" "0 6t"
235 ucidef_set_interface_lan "eth0"
240 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
241 ucidef_add_switch "switch1" "1" "1"
242 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
243 ucidef_add_switch_vlan "switch1" "2" "4 6t"
247 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
248 ucidef_add_switch "switch0" "1" "1"
249 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
250 ucidef_add_switch_vlan "switch0" "2" "0 5t"
253 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
254 if [ -n "${RT3X5X}" ]; then
255 ramips_setup_rt3x5x_vlans
257 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
271 lan_mac=$(cat /sys/class/net/eth0/address)
272 wan_mac=$(mtd_get_mac_binary devdata 7)
276 lan_mac=$(cat /sys/class/net/eth0/address)
277 wan_mac=$(macaddr_add "$lan_mac" 5)
281 lan_mac=$(cat /sys/class/net/eth0/address)
282 wan_mac=$(macaddr_add "$lan_mac" 3)
286 lan_mac=$(cat /sys/class/net/eth0/address)
287 wan_mac=$(macaddr_add "$lan_mac" 4)
294 lan_mac=$(cat /sys/class/net/eth0/address)
295 lan_mac=$(macaddr_add "$lan_mac" -2)
314 lan_mac=$(cat /sys/class/net/eth0/address)
315 lan_mac=$(macaddr_setbit_la "$lan_mac")
316 wan_mac=$(macaddr_add "$lan_mac" 1)
320 lan_mac=$(cat /sys/class/net/eth0/address)
325 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
326 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
330 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
334 wan_mac=$(mtd_get_mac_binary factory 40)
338 lan_mac=$(cat /sys/class/net/eth0/address)
339 lan_mac=$(macaddr_setbit_la "$lan_mac")
340 wan_mac=$(mtd_get_mac_binary factory 32772)
348 wan_mac=$(mtd_get_mac_binary factory 46)
352 wan_mac=$(mtd_get_mac_binary factory 4)
356 local index="$(find_mtd_index "board_data")"
357 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
361 lan_mac=$(cat /sys/class/net/eth0/address)
362 wan_mac=$(macaddr_add "$lan_mac" 1)
367 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
368 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
372 board=$(ramips_board_name)
373 ramips_setup_interfaces $board
374 ramips_setup_macs $board