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"
89 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
90 ucidef_add_switch "switch0" "1" "1"
91 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
92 ucidef_add_switch_vlan "switch0" "2" "4 6t"
95 ucidef_set_interface_lan "eth0.1"
96 ucidef_add_switch "switch0" "1" "1"
97 ucidef_add_switch_vlan "switch0" "1" "0 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" "0 1 2 3 5t"
106 ucidef_add_switch_vlan "switch0" "2" "4 5t"
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"
128 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
129 ucidef_add_switch "switch0" "1" "1"
130 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
131 ucidef_add_switch_vlan "switch0" "2" "0 6t"
134 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
135 ucidef_add_switch "switch0" "1" "1"
136 ucidef_add_switch_vlan "switch0" "1" "0 6t"
137 ucidef_add_switch_vlan "switch0" "2" "1 6t"
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
149 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
150 ucidef_add_switch "switch0" "1" "1"
151 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
152 ucidef_add_switch_vlan "switch0" "2" "0 9t"
155 ucidef_set_interface_lan "eth0.1"
156 ucidef_add_switch "switch0" "1" "1"
157 ucidef_add_switch_vlan "switch0" "1" "4 6t"
160 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
161 ucidef_add_switch "switch0" "1" "1"
162 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
163 ucidef_add_switch_vlan "switch0" "2" "4 9t"
169 ucidef_set_interface_lan "eth0"
173 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
174 ucidef_add_switch "switch1" "1" "1"
175 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
176 ucidef_add_switch_vlan "switch1" "2" "4 6t"
180 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
181 ucidef_add_switch "switch0" "1" "1"
182 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
183 ucidef_add_switch_vlan "switch0" "2" "0 6t"
186 ucidef_add_switch "switch0" "4"
187 ucidef_set_interface_lan "eth0"
193 ucidef_set_interface_lan "eth0.1"
197 ucidef_set_interface_lan "eth0.1"
198 ucidef_add_switch "switch0" "1" "1"
199 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
202 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
203 ucidef_add_switch "switch0" "1" "1"
204 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
205 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_interfaces_lan_wan "eth0.1" "eth0.2"
217 ucidef_add_switch "switch0" "1" "1"
218 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
219 ucidef_add_switch_vlan "switch0" "2" "0 5t"
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"
228 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
229 ucidef_add_switch "switch0" "1" "1"
230 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
231 ucidef_add_switch_vlan "switch0" "2" "5 6t"
234 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
235 ucidef_add_switch "switch0" "1" "1"
236 ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
237 ucidef_add_switch_vlan "switch0" "2" "0 6t"
240 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
241 ucidef_add_switch "switch0" "1" "1"
242 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
243 ucidef_add_switch_vlan "switch0" "2" "4 6t"
246 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
247 if [ -n "${RT3X5X}" ]; then
248 ramips_setup_rt3x5x_vlans
250 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
279 lan_mac=$(cat /sys/class/net/eth0/address)
280 lan_mac=$(macaddr_setbit_la "$lan_mac")
281 wan_mac=$(macaddr_add "$lan_mac" 1)
288 wan_mac=$(mtd_get_mac_binary factory 46)
291 lan_mac=$(cat /sys/class/net/eth0/address)
292 wan_mac=$(mtd_get_mac_binary devdata 7)
296 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
297 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
300 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
303 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
304 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
305 wan_mac=$(macaddr_add "$lan_mac" 1)
308 lan_mac=$(cat /sys/class/net/eth0/address)
312 wan_mac=$(mtd_get_mac_binary factory 4)
313 lan_mac=$(mtd_get_mac_binary factory 46)
319 lan_mac=$(cat /sys/class/net/eth0/address)
320 lan_mac=$(macaddr_add "$lan_mac" -2)
323 lan_mac=$(mtd_get_mac_binary factory 40)
324 wan_mac=$(mtd_get_mac_binary factory 46)
327 lan_mac=$(cat /sys/class/net/eth0/address)
328 lan_mac=$(macaddr_setbit_la "$lan_mac")
329 wan_mac=$(mtd_get_mac_binary factory 32772)
332 lan_mac=$(cat /sys/class/net/eth0/address)
333 wan_mac=$(macaddr_add "$lan_mac" 3)
336 lan_mac=$(cat /sys/class/net/eth0/address)
337 wan_mac=$(macaddr_add "$lan_mac" 4)
340 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
341 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
344 lan_mac=$(cat /sys/class/net/eth0/address)
345 wan_mac=$(macaddr_add "$lan_mac" 5)
348 wan_mac=$(mtd_get_mac_binary factory 40)
354 wan_mac=$(mtd_get_mac_binary factory 4)
358 lan_mac=$(mtd_get_mac_binary factory 4)
359 wan_mac=$(mtd_get_mac_binary factory 40)
362 local index="$(find_mtd_index "board_data")"
363 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
367 lan_mac=$(cat /sys/class/net/eth0/address)
368 wan_mac=$(macaddr_add "$lan_mac" 1)
372 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
373 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
377 board=$(ramips_board_name)
378 ramips_setup_interfaces $board
379 ramips_setup_macs $board