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"
142 xiaomi-miwifi-mini |\
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" "4 6t"
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_add_switch "switch0" "1" "1"
153 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
154 ucidef_add_switch_vlan "switch0" "2" "5 6t"
170 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
171 ucidef_add_switch "switch0" "1" "1"
172 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
173 ucidef_add_switch_vlan "switch0" "2" "0 6t"
177 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
182 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
183 ucidef_add_switch "switch0" "1" "1"
184 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
185 ucidef_add_switch_vlan "switch0" "2" "0 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 5t"
195 ucidef_add_switch_vlan "switch0" "2" "4 5t"
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
200 ucidef_add_switch "switch0" "1" "1"
201 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
202 ucidef_add_switch_vlan "switch0" "2" "4 8t"
207 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
208 ucidef_add_switch "switch0" "1" "1"
209 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
210 ucidef_add_switch_vlan "switch0" "2" "0t 5"
214 ucidef_set_interface_lan "eth0.1"
215 ucidef_add_switch "switch0" "1" "1"
216 ucidef_add_switch_vlan "switch0" "1" "0 4 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 6t"
223 ucidef_add_switch_vlan "switch0" "2" "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" "0 1 2 3 4 6t"
230 ucidef_add_switch_vlan "switch0" "2" "4 6t"
234 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
235 ucidef_add_switch "switch0" "1" "1"
236 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
237 ucidef_add_switch_vlan "switch0" "2" "0 6t"
243 ucidef_set_interface_lan "eth0"
248 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
249 ucidef_add_switch "switch1" "1" "1"
250 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
251 ucidef_add_switch_vlan "switch1" "2" "4 6t"
255 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
256 ucidef_add_switch "switch0" "1" "1"
257 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
258 ucidef_add_switch_vlan "switch0" "2" "0 5t"
261 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
262 if [ -n "${RT3X5X}" ]; then
263 ramips_setup_rt3x5x_vlans
265 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
279 lan_mac=$(cat /sys/class/net/eth0/address)
280 wan_mac=$(mtd_get_mac_binary devdata 7)
284 lan_mac=$(cat /sys/class/net/eth0/address)
285 wan_mac=$(macaddr_add "$lan_mac" 5)
289 lan_mac=$(cat /sys/class/net/eth0/address)
290 wan_mac=$(macaddr_add "$lan_mac" 3)
294 lan_mac=$(cat /sys/class/net/eth0/address)
295 wan_mac=$(macaddr_add "$lan_mac" 4)
302 lan_mac=$(cat /sys/class/net/eth0/address)
303 lan_mac=$(macaddr_add "$lan_mac" -2)
322 lan_mac=$(cat /sys/class/net/eth0/address)
323 lan_mac=$(macaddr_setbit_la "$lan_mac")
324 wan_mac=$(macaddr_add "$lan_mac" 1)
328 lan_mac=$(cat /sys/class/net/eth0/address)
333 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
334 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
338 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
342 wan_mac=$(mtd_get_mac_binary factory 40)
346 lan_mac=$(cat /sys/class/net/eth0/address)
347 lan_mac=$(macaddr_setbit_la "$lan_mac")
348 wan_mac=$(mtd_get_mac_binary factory 32772)
356 wan_mac=$(mtd_get_mac_binary factory 46)
359 wsr-600|whr-300hp2|whr-600d|whr-1166d)
360 wan_mac=$(mtd_get_mac_binary factory 4)
364 local index="$(find_mtd_index "board_data")"
365 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
369 lan_mac=$(cat /sys/class/net/eth0/address)
370 wan_mac=$(macaddr_add "$lan_mac" 1)
375 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
376 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
380 board=$(ramips_board_name)
381 ramips_setup_interfaces $board
382 ramips_setup_macs $board