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
56 ucidef_add_switch "switch0" "1" "0"
57 ucidef_set_interface_lan "eth0"
62 ucidef_set_interface_lan "eth0.2"
90 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
91 ucidef_add_switch "switch0" "1" "1"
92 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
93 ucidef_add_switch_vlan "switch0" "2" "4 6t"
96 ucidef_set_interface_lan "eth0.1"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "0 6t"
104 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
105 ucidef_add_switch "switch0" "1" "1"
106 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
107 ucidef_add_switch_vlan "switch0" "2" "4 5t"
112 ucidef_set_interface_lan "eth0.1"
113 ucidef_add_switch "switch0" "1" "1"
114 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
129 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
130 ucidef_add_switch "switch0" "1" "1"
131 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
132 ucidef_add_switch_vlan "switch0" "2" "0 6t"
135 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
136 ucidef_add_switch "switch0" "1" "1"
137 ucidef_add_switch_vlan "switch0" "1" "0 6t"
138 ucidef_add_switch_vlan "switch0" "2" "1 6t"
147 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
150 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
151 ucidef_add_switch "switch0" "1" "1"
152 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
153 ucidef_add_switch_vlan "switch0" "2" "0 9t"
156 ucidef_set_interface_lan "eth0.1"
157 ucidef_add_switch "switch0" "1" "1"
158 ucidef_add_switch_vlan "switch0" "1" "4 6t"
161 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
162 ucidef_add_switch "switch0" "1" "1"
163 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
164 ucidef_add_switch_vlan "switch0" "2" "4 9t"
170 ucidef_set_interface_lan "eth0"
174 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
175 ucidef_add_switch "switch1" "1" "1"
176 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
177 ucidef_add_switch_vlan "switch1" "2" "4 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 5 6t"
184 ucidef_add_switch_vlan "switch0" "2" "0 6t"
187 ucidef_add_switch "switch0" "4"
188 ucidef_set_interface_lan "eth0"
194 ucidef_set_interface_lan "eth0.1"
198 ucidef_set_interface_lan "eth0.1"
199 ucidef_add_switch "switch0" "1" "1"
200 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
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"
210 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
211 ucidef_add_switch "switch0" "1" "1"
212 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
213 ucidef_add_switch_vlan "switch0" "2" "0t 5"
217 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
218 ucidef_add_switch "switch0" "1" "1"
219 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
220 ucidef_add_switch_vlan "switch0" "2" "0 5t"
223 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
224 ucidef_add_switch "switch0" "1" "1"
225 ucidef_add_switch_vlan "switch0" "1" "0 6t"
226 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 6t"
232 ucidef_add_switch_vlan "switch0" "2" "5 6t"
235 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
236 ucidef_add_switch "switch0" "1" "1"
237 ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
238 ucidef_add_switch_vlan "switch0" "2" "0 6t"
241 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
242 ucidef_add_switch "switch0" "1" "1"
243 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
244 ucidef_add_switch_vlan "switch0" "2" "4 6t"
247 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
248 if [ -n "${RT3X5X}" ]; then
249 ramips_setup_rt3x5x_vlans
251 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
280 lan_mac=$(cat /sys/class/net/eth0/address)
281 lan_mac=$(macaddr_setbit_la "$lan_mac")
282 wan_mac=$(macaddr_add "$lan_mac" 1)
289 wan_mac=$(mtd_get_mac_binary factory 46)
292 lan_mac=$(cat /sys/class/net/eth0/address)
293 wan_mac=$(mtd_get_mac_binary devdata 7)
297 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
298 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
301 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
304 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
305 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
306 wan_mac=$(macaddr_add "$lan_mac" 1)
309 lan_mac=$(cat /sys/class/net/eth0/address)
313 wan_mac=$(mtd_get_mac_binary factory 4)
314 lan_mac=$(mtd_get_mac_binary factory 46)
320 lan_mac=$(cat /sys/class/net/eth0/address)
321 lan_mac=$(macaddr_add "$lan_mac" -2)
324 lan_mac=$(mtd_get_mac_binary factory 40)
325 wan_mac=$(mtd_get_mac_binary factory 46)
328 lan_mac=$(cat /sys/class/net/eth0/address)
329 lan_mac=$(macaddr_setbit_la "$lan_mac")
330 wan_mac=$(mtd_get_mac_binary factory 32772)
333 lan_mac=$(cat /sys/class/net/eth0/address)
334 wan_mac=$(macaddr_add "$lan_mac" 3)
337 lan_mac=$(cat /sys/class/net/eth0/address)
338 wan_mac=$(macaddr_add "$lan_mac" 4)
341 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
342 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
345 lan_mac=$(cat /sys/class/net/eth0/address)
346 wan_mac=$(macaddr_add "$lan_mac" 5)
349 wan_mac=$(mtd_get_mac_binary factory 40)
355 wan_mac=$(mtd_get_mac_binary factory 4)
359 lan_mac=$(mtd_get_mac_binary factory 4)
360 wan_mac=$(mtd_get_mac_binary factory 40)
363 local index="$(find_mtd_index "board_data")"
364 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
368 lan_mac=$(cat /sys/class/net/eth0/address)
369 wan_mac=$(macaddr_add "$lan_mac" 1)
373 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
374 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
378 board=$(ramips_board_name)
379 ramips_setup_interfaces $board
380 ramips_setup_macs $board