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"
66 ucidef_set_interface_lan "eth0.2"
69 ucidef_set_interface_lan "eth0.1"
73 ucidef_add_switch "switch0" "4"
74 ucidef_set_interface_lan "eth0"
80 ucidef_set_interface_lan "eth0.1"
89 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
93 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
94 ucidef_add_switch "switch0" "1" "1"
95 ucidef_add_switch_vlan "switch0" "1" "0 6t"
96 ucidef_add_switch_vlan "switch0" "2" "1 6t"
100 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
101 ucidef_add_switch "switch0" "1" "1"
102 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
103 ucidef_add_switch_vlan "switch0" "2" "0 9t"
107 ucidef_set_interface_lan "eth0.1"
108 ucidef_add_switch "switch0" "1" "1"
109 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
113 ucidef_set_interface_lan "eth0.1"
114 ucidef_add_switch "switch0" "1" "1"
115 ucidef_add_switch_vlan "switch0" "1" "4 6t"
119 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
120 ucidef_add_switch "switch0" "1" "1"
121 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
122 ucidef_add_switch_vlan "switch0" "2" "4 9t"
143 xiaomi-miwifi-mini |\
145 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
146 ucidef_add_switch "switch0" "1" "1"
147 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
148 ucidef_add_switch_vlan "switch0" "2" "4 6t"
152 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153 ucidef_add_switch "switch0" "1" "1"
154 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
155 ucidef_add_switch_vlan "switch0" "2" "5 6t"
171 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
172 ucidef_add_switch "switch0" "1" "1"
173 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
174 ucidef_add_switch_vlan "switch0" "2" "0 6t"
178 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
183 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
184 ucidef_add_switch "switch0" "1" "1"
185 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
186 ucidef_add_switch_vlan "switch0" "2" "0 5t"
193 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
194 ucidef_add_switch "switch0" "1" "1"
195 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
196 ucidef_add_switch_vlan "switch0" "2" "4 5t"
200 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
201 ucidef_add_switch "switch0" "1" "1"
202 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
203 ucidef_add_switch_vlan "switch0" "2" "4 8t"
208 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
209 ucidef_add_switch "switch0" "1" "1"
210 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
211 ucidef_add_switch_vlan "switch0" "2" "0t 5"
215 ucidef_set_interface_lan "eth0.1"
216 ucidef_add_switch "switch0" "1" "1"
217 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
221 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
222 ucidef_add_switch "switch0" "1" "1"
223 ucidef_add_switch_vlan "switch0" "1" "0 6t"
224 ucidef_add_switch_vlan "switch0" "2" "6t"
228 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
229 ucidef_add_switch "switch0" "1" "1"
230 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
231 ucidef_add_switch_vlan "switch0" "2" "4 6t"
235 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
236 ucidef_add_switch "switch0" "1" "1"
237 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
238 ucidef_add_switch_vlan "switch0" "2" "0 6t"
244 ucidef_set_interface_lan "eth0"
249 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
250 ucidef_add_switch "switch1" "1" "1"
251 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
252 ucidef_add_switch_vlan "switch1" "2" "4 6t"
256 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
257 ucidef_add_switch "switch0" "1" "1"
258 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
259 ucidef_add_switch_vlan "switch0" "2" "0 5t"
262 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
263 if [ -n "${RT3X5X}" ]; then
264 ramips_setup_rt3x5x_vlans
266 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
280 lan_mac=$(cat /sys/class/net/eth0/address)
281 wan_mac=$(mtd_get_mac_binary devdata 7)
285 lan_mac=$(cat /sys/class/net/eth0/address)
286 wan_mac=$(macaddr_add "$lan_mac" 5)
290 lan_mac=$(cat /sys/class/net/eth0/address)
291 wan_mac=$(macaddr_add "$lan_mac" 3)
295 lan_mac=$(cat /sys/class/net/eth0/address)
296 wan_mac=$(macaddr_add "$lan_mac" 4)
303 lan_mac=$(cat /sys/class/net/eth0/address)
304 lan_mac=$(macaddr_add "$lan_mac" -2)
323 lan_mac=$(cat /sys/class/net/eth0/address)
324 lan_mac=$(macaddr_setbit_la "$lan_mac")
325 wan_mac=$(macaddr_add "$lan_mac" 1)
329 lan_mac=$(cat /sys/class/net/eth0/address)
334 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
335 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
339 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
343 wan_mac=$(mtd_get_mac_binary factory 40)
347 lan_mac=$(cat /sys/class/net/eth0/address)
348 lan_mac=$(macaddr_setbit_la "$lan_mac")
349 wan_mac=$(mtd_get_mac_binary factory 32772)
357 wan_mac=$(mtd_get_mac_binary factory 46)
360 wsr-600|whr-300hp2|whr-600d|whr-1166d)
361 wan_mac=$(mtd_get_mac_binary factory 4)
365 local index="$(find_mtd_index "board_data")"
366 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
370 lan_mac=$(cat /sys/class/net/eth0/address)
371 wan_mac=$(macaddr_add "$lan_mac" 1)
376 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
377 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
381 board=$(ramips_board_name)
382 ramips_setup_interfaces $board
383 ramips_setup_macs $board