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"
62 ucidef_add_switch "switch0" "1" "0"
63 ucidef_set_interface_lan "eth0"
69 ucidef_set_interface_lan "eth0.2"
72 ucidef_set_interface_lan "eth0.1"
76 ucidef_add_switch "switch0" "4"
77 ucidef_set_interface_lan "eth0"
83 ucidef_set_interface_lan "eth0.1"
92 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
96 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "0 6t"
99 ucidef_add_switch_vlan "switch0" "2" "1 6t"
103 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
104 ucidef_add_switch "switch0" "1" "1"
105 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
106 ucidef_add_switch_vlan "switch0" "2" "0 9t"
111 ucidef_set_interface_lan "eth0.1"
112 ucidef_add_switch "switch0" "1" "1"
113 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
117 ucidef_set_interface_lan "eth0.1"
118 ucidef_add_switch "switch0" "1" "1"
119 ucidef_add_switch_vlan "switch0" "1" "4 6t"
123 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
124 ucidef_add_switch "switch0" "1" "1"
125 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
126 ucidef_add_switch_vlan "switch0" "2" "4 9t"
147 xiaomi-miwifi-mini |\
150 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
151 ucidef_add_switch "switch0" "1" "1"
152 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
153 ucidef_add_switch_vlan "switch0" "2" "4 6t"
157 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
158 ucidef_add_switch "switch0" "1" "1"
159 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
160 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 6t"
166 ucidef_add_switch_vlan "switch0" "2" "0 6t"
181 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
182 ucidef_add_switch "switch0" "1" "1"
183 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
184 ucidef_add_switch_vlan "switch0" "2" "0 6t"
188 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
193 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
194 ucidef_add_switch "switch0" "1" "1"
195 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
196 ucidef_add_switch_vlan "switch0" "2" "0 5t"
203 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
204 ucidef_add_switch "switch0" "1" "1"
205 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
206 ucidef_add_switch_vlan "switch0" "2" "4 5t"
210 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
211 ucidef_add_switch "switch0" "1" "1"
212 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
213 ucidef_add_switch_vlan "switch0" "2" "4 8t"
218 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
219 ucidef_add_switch "switch0" "1" "1"
220 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
221 ucidef_add_switch_vlan "switch0" "2" "0t 5"
225 ucidef_set_interface_lan "eth0.1"
226 ucidef_add_switch "switch0" "1" "1"
227 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
231 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
232 ucidef_add_switch "switch0" "1" "1"
233 ucidef_add_switch_vlan "switch0" "1" "0 6t"
234 ucidef_add_switch_vlan "switch0" "2" "6t"
238 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
239 ucidef_add_switch "switch0" "1" "1"
240 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
241 ucidef_add_switch_vlan "switch0" "2" "4 6t"
245 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
246 ucidef_add_switch "switch0" "1" "1"
247 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
248 ucidef_add_switch_vlan "switch0" "2" "0 6t"
254 ucidef_set_interface_lan "eth0"
259 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
260 ucidef_add_switch "switch1" "1" "1"
261 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
262 ucidef_add_switch_vlan "switch1" "2" "4 6t"
266 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
267 ucidef_add_switch "switch0" "1" "1"
268 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
269 ucidef_add_switch_vlan "switch0" "2" "0 5t"
272 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
273 if [ -n "${RT3X5X}" ]; then
274 ramips_setup_rt3x5x_vlans
276 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
290 lan_mac=$(cat /sys/class/net/eth0/address)
291 wan_mac=$(mtd_get_mac_binary devdata 7)
295 lan_mac=$(cat /sys/class/net/eth0/address)
296 wan_mac=$(macaddr_add "$lan_mac" 5)
300 lan_mac=$(cat /sys/class/net/eth0/address)
301 wan_mac=$(macaddr_add "$lan_mac" 3)
305 lan_mac=$(cat /sys/class/net/eth0/address)
306 wan_mac=$(macaddr_add "$lan_mac" 4)
313 lan_mac=$(cat /sys/class/net/eth0/address)
314 lan_mac=$(macaddr_add "$lan_mac" -2)
333 lan_mac=$(cat /sys/class/net/eth0/address)
334 lan_mac=$(macaddr_setbit_la "$lan_mac")
335 wan_mac=$(macaddr_add "$lan_mac" 1)
339 lan_mac=$(cat /sys/class/net/eth0/address)
344 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
345 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
349 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
353 wan_mac=$(mtd_get_mac_binary factory 40)
357 lan_mac=$(cat /sys/class/net/eth0/address)
358 lan_mac=$(macaddr_setbit_la "$lan_mac")
359 wan_mac=$(mtd_get_mac_binary factory 32772)
367 wan_mac=$(mtd_get_mac_binary factory 46)
370 wsr-600|whr-300hp2|whr-600d|whr-1166d)
371 wan_mac=$(mtd_get_mac_binary factory 4)
375 lan_mac=$(mtd_get_mac_binary factory 4)
376 wan_mac=$(mtd_get_mac_binary factory 40)
379 local index="$(find_mtd_index "board_data")"
380 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
385 wan_mac=$(mtd_get_mac_binary factory 4)
386 lan_mac=$(mtd_get_mac_binary factory 46)
389 lan_mac=$(cat /sys/class/net/eth0/address)
390 wan_mac=$(macaddr_add "$lan_mac" 1)
395 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
396 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
400 board=$(ramips_board_name)
401 ramips_setup_interfaces $board
402 ramips_setup_macs $board