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"
118 ucidef_set_interface_lan "eth0.1"
119 ucidef_add_switch "switch0" "1" "1"
120 ucidef_add_switch_vlan "switch0" "1" "4 6t"
124 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
125 ucidef_add_switch "switch0" "1" "1"
126 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
127 ucidef_add_switch_vlan "switch0" "2" "4 9t"
148 xiaomi-miwifi-mini |\
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" "4 6t"
158 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
159 ucidef_add_switch "switch0" "1" "1"
160 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
161 ucidef_add_switch_vlan "switch0" "2" "5 6t"
164 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
167 ucidef_add_switch_vlan "switch0" "2" "0 6t"
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 6t"
185 ucidef_add_switch_vlan "switch0" "2" "0 6t"
189 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
194 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
195 ucidef_add_switch "switch0" "1" "1"
196 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
197 ucidef_add_switch_vlan "switch0" "2" "0 5t"
204 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
205 ucidef_add_switch "switch0" "1" "1"
206 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
207 ucidef_add_switch_vlan "switch0" "2" "4 5t"
211 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
212 ucidef_add_switch "switch0" "1" "1"
213 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
214 ucidef_add_switch_vlan "switch0" "2" "4 8t"
219 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
220 ucidef_add_switch "switch0" "1" "1"
221 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
222 ucidef_add_switch_vlan "switch0" "2" "0t 5"
226 ucidef_set_interface_lan "eth0.1"
227 ucidef_add_switch "switch0" "1" "1"
228 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
232 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
233 ucidef_add_switch "switch0" "1" "1"
234 ucidef_add_switch_vlan "switch0" "1" "0 6t"
235 ucidef_add_switch_vlan "switch0" "2" "6t"
239 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
240 ucidef_add_switch "switch0" "1" "1"
241 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
242 ucidef_add_switch_vlan "switch0" "2" "4 6t"
246 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
247 ucidef_add_switch "switch0" "1" "1"
248 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
249 ucidef_add_switch_vlan "switch0" "2" "0 6t"
255 ucidef_set_interface_lan "eth0"
260 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
261 ucidef_add_switch "switch1" "1" "1"
262 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
263 ucidef_add_switch_vlan "switch1" "2" "4 6t"
267 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
268 ucidef_add_switch "switch0" "1" "1"
269 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
270 ucidef_add_switch_vlan "switch0" "2" "0 5t"
273 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
274 if [ -n "${RT3X5X}" ]; then
275 ramips_setup_rt3x5x_vlans
277 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
291 lan_mac=$(cat /sys/class/net/eth0/address)
292 wan_mac=$(mtd_get_mac_binary devdata 7)
296 lan_mac=$(cat /sys/class/net/eth0/address)
297 wan_mac=$(macaddr_add "$lan_mac" 5)
301 lan_mac=$(cat /sys/class/net/eth0/address)
302 wan_mac=$(macaddr_add "$lan_mac" 3)
306 lan_mac=$(cat /sys/class/net/eth0/address)
307 wan_mac=$(macaddr_add "$lan_mac" 4)
314 lan_mac=$(cat /sys/class/net/eth0/address)
315 lan_mac=$(macaddr_add "$lan_mac" -2)
334 lan_mac=$(cat /sys/class/net/eth0/address)
335 lan_mac=$(macaddr_setbit_la "$lan_mac")
336 wan_mac=$(macaddr_add "$lan_mac" 1)
340 lan_mac=$(cat /sys/class/net/eth0/address)
345 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
346 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
350 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
354 wan_mac=$(mtd_get_mac_binary factory 40)
358 lan_mac=$(cat /sys/class/net/eth0/address)
359 lan_mac=$(macaddr_setbit_la "$lan_mac")
360 wan_mac=$(mtd_get_mac_binary factory 32772)
368 wan_mac=$(mtd_get_mac_binary factory 46)
371 wsr-600|whr-300hp2|whr-600d|whr-1166d)
372 wan_mac=$(mtd_get_mac_binary factory 4)
376 lan_mac=$(mtd_get_mac_binary factory 4)
377 wan_mac=$(mtd_get_mac_binary factory 40)
380 local index="$(find_mtd_index "board_data")"
381 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
386 wan_mac=$(mtd_get_mac_binary factory 4)
387 lan_mac=$(mtd_get_mac_binary factory 46)
390 lan_mac=$(cat /sys/class/net/eth0/address)
391 wan_mac=$(macaddr_add "$lan_mac" 1)
396 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
397 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
401 board=$(ramips_board_name)
402 ramips_setup_interfaces $board
403 ramips_setup_macs $board