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_interfaces_lan_wan "eth0.1" "eth0.2"
113 ucidef_add_switch "switch0" "1" "1"
114 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
115 ucidef_add_switch_vlan "switch0" "2" "4 9t"
135 xiaomi-miwifi-mini |\
137 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138 ucidef_add_switch "switch0" "1" "1"
139 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
140 ucidef_add_switch_vlan "switch0" "2" "4 6t"
144 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
145 ucidef_add_switch "switch0" "1" "1"
146 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
147 ucidef_add_switch_vlan "switch0" "2" "5 6t"
163 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
164 ucidef_add_switch "switch0" "1" "1"
165 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
166 ucidef_add_switch_vlan "switch0" "2" "0 6t"
170 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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 5t"
178 ucidef_add_switch_vlan "switch0" "2" "0 5t"
185 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
186 ucidef_add_switch "switch0" "1" "1"
187 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
188 ucidef_add_switch_vlan "switch0" "2" "4 5t"
192 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
193 ucidef_add_switch "switch0" "1" "1"
194 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
195 ucidef_add_switch_vlan "switch0" "2" "4 8t"
200 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
201 ucidef_add_switch "switch0" "1" "1"
202 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
203 ucidef_add_switch_vlan "switch0" "2" "0t 5"
207 ucidef_set_interface_lan "eth0.1"
208 ucidef_add_switch "switch0" "1" "1"
209 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
213 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_vlan "switch0" "1" "0 6t"
216 ucidef_add_switch_vlan "switch0" "2" "6t"
220 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
221 ucidef_add_switch "switch0" "1" "1"
222 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
223 ucidef_add_switch_vlan "switch0" "2" "4 6t"
227 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
228 ucidef_add_switch "switch0" "1" "1"
229 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
230 ucidef_add_switch_vlan "switch0" "2" "0 6t"
236 ucidef_set_interface_lan "eth0"
241 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
242 ucidef_add_switch "switch1" "1" "1"
243 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
244 ucidef_add_switch_vlan "switch1" "2" "4 6t"
248 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
249 ucidef_add_switch "switch0" "1" "1"
250 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
251 ucidef_add_switch_vlan "switch0" "2" "0 5t"
254 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
255 if [ -n "${RT3X5X}" ]; then
256 ramips_setup_rt3x5x_vlans
258 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
272 lan_mac=$(cat /sys/class/net/eth0/address)
273 wan_mac=$(mtd_get_mac_binary devdata 7)
277 lan_mac=$(cat /sys/class/net/eth0/address)
278 wan_mac=$(macaddr_add "$lan_mac" 5)
282 lan_mac=$(cat /sys/class/net/eth0/address)
283 wan_mac=$(macaddr_add "$lan_mac" 3)
287 lan_mac=$(cat /sys/class/net/eth0/address)
288 wan_mac=$(macaddr_add "$lan_mac" 4)
295 lan_mac=$(cat /sys/class/net/eth0/address)
296 lan_mac=$(macaddr_add "$lan_mac" -2)
315 lan_mac=$(cat /sys/class/net/eth0/address)
316 lan_mac=$(macaddr_setbit_la "$lan_mac")
317 wan_mac=$(macaddr_add "$lan_mac" 1)
321 lan_mac=$(cat /sys/class/net/eth0/address)
326 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
327 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
331 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
335 wan_mac=$(mtd_get_mac_binary factory 40)
339 lan_mac=$(cat /sys/class/net/eth0/address)
340 lan_mac=$(macaddr_setbit_la "$lan_mac")
341 wan_mac=$(mtd_get_mac_binary factory 32772)
349 wan_mac=$(mtd_get_mac_binary factory 46)
353 wan_mac=$(mtd_get_mac_binary factory 4)
357 local index="$(find_mtd_index "board_data")"
358 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
362 lan_mac=$(cat /sys/class/net/eth0/address)
363 wan_mac=$(macaddr_add "$lan_mac" 1)
368 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
369 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
373 board=$(ramips_board_name)
374 ramips_setup_interfaces $board
375 ramips_setup_macs $board