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"
108 ucidef_set_interface_lan "eth0.1"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
114 ucidef_set_interface_lan "eth0.1"
115 ucidef_add_switch "switch0" "1" "1"
116 ucidef_add_switch_vlan "switch0" "1" "4 6t"
120 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
121 ucidef_add_switch "switch0" "1" "1"
122 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
123 ucidef_add_switch_vlan "switch0" "2" "4 9t"
144 xiaomi-miwifi-mini |\
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
147 ucidef_add_switch "switch0" "1" "1"
148 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
149 ucidef_add_switch_vlan "switch0" "2" "4 6t"
153 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
154 ucidef_add_switch "switch0" "1" "1"
155 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
156 ucidef_add_switch_vlan "switch0" "2" "5 6t"
172 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
173 ucidef_add_switch "switch0" "1" "1"
174 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
175 ucidef_add_switch_vlan "switch0" "2" "0 6t"
179 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
184 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
185 ucidef_add_switch "switch0" "1" "1"
186 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
187 ucidef_add_switch_vlan "switch0" "2" "0 5t"
194 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
195 ucidef_add_switch "switch0" "1" "1"
196 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
197 ucidef_add_switch_vlan "switch0" "2" "4 5t"
201 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
202 ucidef_add_switch "switch0" "1" "1"
203 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
204 ucidef_add_switch_vlan "switch0" "2" "4 8t"
209 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
210 ucidef_add_switch "switch0" "1" "1"
211 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
212 ucidef_add_switch_vlan "switch0" "2" "0t 5"
216 ucidef_set_interface_lan "eth0.1"
217 ucidef_add_switch "switch0" "1" "1"
218 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
222 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
223 ucidef_add_switch "switch0" "1" "1"
224 ucidef_add_switch_vlan "switch0" "1" "0 6t"
225 ucidef_add_switch_vlan "switch0" "2" "6t"
229 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
230 ucidef_add_switch "switch0" "1" "1"
231 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
232 ucidef_add_switch_vlan "switch0" "2" "4 6t"
236 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
237 ucidef_add_switch "switch0" "1" "1"
238 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
239 ucidef_add_switch_vlan "switch0" "2" "0 6t"
245 ucidef_set_interface_lan "eth0"
250 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
251 ucidef_add_switch "switch1" "1" "1"
252 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
253 ucidef_add_switch_vlan "switch1" "2" "4 6t"
257 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
258 ucidef_add_switch "switch0" "1" "1"
259 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
260 ucidef_add_switch_vlan "switch0" "2" "0 5t"
263 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
264 if [ -n "${RT3X5X}" ]; then
265 ramips_setup_rt3x5x_vlans
267 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
281 lan_mac=$(cat /sys/class/net/eth0/address)
282 wan_mac=$(mtd_get_mac_binary devdata 7)
286 lan_mac=$(cat /sys/class/net/eth0/address)
287 wan_mac=$(macaddr_add "$lan_mac" 5)
291 lan_mac=$(cat /sys/class/net/eth0/address)
292 wan_mac=$(macaddr_add "$lan_mac" 3)
296 lan_mac=$(cat /sys/class/net/eth0/address)
297 wan_mac=$(macaddr_add "$lan_mac" 4)
304 lan_mac=$(cat /sys/class/net/eth0/address)
305 lan_mac=$(macaddr_add "$lan_mac" -2)
324 lan_mac=$(cat /sys/class/net/eth0/address)
325 lan_mac=$(macaddr_setbit_la "$lan_mac")
326 wan_mac=$(macaddr_add "$lan_mac" 1)
330 lan_mac=$(cat /sys/class/net/eth0/address)
335 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
336 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
340 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
344 wan_mac=$(mtd_get_mac_binary factory 40)
348 lan_mac=$(cat /sys/class/net/eth0/address)
349 lan_mac=$(macaddr_setbit_la "$lan_mac")
350 wan_mac=$(mtd_get_mac_binary factory 32772)
358 wan_mac=$(mtd_get_mac_binary factory 46)
361 wsr-600|whr-300hp2|whr-600d|whr-1166d)
362 wan_mac=$(mtd_get_mac_binary factory 4)
366 local index="$(find_mtd_index "board_data")"
367 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
371 lan_mac=$(cat /sys/class/net/eth0/address)
372 wan_mac=$(macaddr_add "$lan_mac" 1)
377 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
378 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
382 board=$(ramips_board_name)
383 ramips_setup_interfaces $board
384 ramips_setup_macs $board