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"
109 ucidef_set_interface_lan "eth0.1"
110 ucidef_add_switch "switch0" "1" "1"
111 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
115 ucidef_set_interface_lan "eth0.1"
116 ucidef_add_switch "switch0" "1" "1"
117 ucidef_add_switch_vlan "switch0" "1" "4 6t"
121 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
122 ucidef_add_switch "switch0" "1" "1"
123 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
124 ucidef_add_switch_vlan "switch0" "2" "4 9t"
146 xiaomi-miwifi-mini |\
148 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
149 ucidef_add_switch "switch0" "1" "1"
150 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
151 ucidef_add_switch_vlan "switch0" "2" "4 6t"
155 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
156 ucidef_add_switch "switch0" "1" "1"
157 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
158 ucidef_add_switch_vlan "switch0" "2" "5 6t"
174 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
175 ucidef_add_switch "switch0" "1" "1"
176 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
177 ucidef_add_switch_vlan "switch0" "2" "0 6t"
181 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
186 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
187 ucidef_add_switch "switch0" "1" "1"
188 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
189 ucidef_add_switch_vlan "switch0" "2" "0 5t"
196 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
197 ucidef_add_switch "switch0" "1" "1"
198 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
199 ucidef_add_switch_vlan "switch0" "2" "4 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 8t"
206 ucidef_add_switch_vlan "switch0" "2" "4 8t"
211 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
212 ucidef_add_switch "switch0" "1" "1"
213 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
214 ucidef_add_switch_vlan "switch0" "2" "0t 5"
218 ucidef_set_interface_lan "eth0.1"
219 ucidef_add_switch "switch0" "1" "1"
220 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
224 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
225 ucidef_add_switch "switch0" "1" "1"
226 ucidef_add_switch_vlan "switch0" "1" "0 6t"
227 ucidef_add_switch_vlan "switch0" "2" "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 1 2 3 4 6t"
234 ucidef_add_switch_vlan "switch0" "2" "4 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" "1 2 3 4 5 6t"
241 ucidef_add_switch_vlan "switch0" "2" "0 6t"
247 ucidef_set_interface_lan "eth0"
252 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
253 ucidef_add_switch "switch1" "1" "1"
254 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
255 ucidef_add_switch_vlan "switch1" "2" "4 6t"
259 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
260 ucidef_add_switch "switch0" "1" "1"
261 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
262 ucidef_add_switch_vlan "switch0" "2" "0 5t"
265 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
266 if [ -n "${RT3X5X}" ]; then
267 ramips_setup_rt3x5x_vlans
269 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
283 lan_mac=$(cat /sys/class/net/eth0/address)
284 wan_mac=$(mtd_get_mac_binary devdata 7)
288 lan_mac=$(mtd_get_mac_binary factory 40)
289 wan_mac=$(mtd_get_mac_binary factory 46)
293 lan_mac=$(cat /sys/class/net/eth0/address)
294 wan_mac=$(macaddr_add "$lan_mac" 5)
298 lan_mac=$(cat /sys/class/net/eth0/address)
299 wan_mac=$(macaddr_add "$lan_mac" 3)
303 lan_mac=$(cat /sys/class/net/eth0/address)
304 wan_mac=$(macaddr_add "$lan_mac" 4)
311 lan_mac=$(cat /sys/class/net/eth0/address)
312 lan_mac=$(macaddr_add "$lan_mac" -2)
331 lan_mac=$(cat /sys/class/net/eth0/address)
332 lan_mac=$(macaddr_setbit_la "$lan_mac")
333 wan_mac=$(macaddr_add "$lan_mac" 1)
337 lan_mac=$(cat /sys/class/net/eth0/address)
342 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
343 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
347 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
351 wan_mac=$(mtd_get_mac_binary factory 40)
355 lan_mac=$(cat /sys/class/net/eth0/address)
356 lan_mac=$(macaddr_setbit_la "$lan_mac")
357 wan_mac=$(mtd_get_mac_binary factory 32772)
365 wan_mac=$(mtd_get_mac_binary factory 46)
368 wsr-600|whr-300hp2|whr-600d|whr-1166d)
369 wan_mac=$(mtd_get_mac_binary factory 4)
373 local index="$(find_mtd_index "board_data")"
374 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
378 lan_mac=$(cat /sys/class/net/eth0/address)
379 wan_mac=$(macaddr_add "$lan_mac" 1)
384 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
385 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
389 board=$(ramips_board_name)
390 ramips_setup_interfaces $board
391 ramips_setup_macs $board