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:wan $wanports"
24 lanports="$port:lan $lanports"
27 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
28 ucidef_add_switch "rt305x" "1" "1"
29 ucidef_add_switch_ports "rt305x" $lanports $wanports "6@eth0"
32 ramips_setup_interfaces()
36 ucidef_set_interface_loopback
55 ucidef_add_switch "switch0" "1" "0"
56 ucidef_set_interface_lan "eth0"
61 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_ports "switch0" \
92 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
95 ucidef_set_interface_lan "eth0.1"
96 ucidef_add_switch "switch0" "1" "1"
97 ucidef_add_switch_ports "switch0" \
104 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
105 ucidef_add_switch "switch0" "1" "1"
106 ucidef_add_switch_ports "switch0" \
107 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
112 ucidef_set_interface_lan "eth0.1"
113 ucidef_add_switch "switch0" "1" "1"
114 ucidef_add_switch_ports "switch0" \
115 "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
130 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
131 ucidef_add_switch "switch0" "1" "1"
132 ucidef_add_switch_ports "switch0" \
133 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
136 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
137 ucidef_add_switch "switch0" "1" "1"
138 ucidef_add_switch_ports "switch0" \
139 "0:lan" "1:wan" "6@eth0"
148 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_add_switch "switch0" "1" "1"
153 ucidef_add_switch_ports "switch0" \
154 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
157 ucidef_set_interface_lan "eth0.1"
158 ucidef_add_switch "switch0" "1" "1"
159 ucidef_add_switch_ports "switch0" \
163 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
164 ucidef_add_switch "switch0" "1" "1"
165 ucidef_add_switch_ports "switch0" \
166 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
172 ucidef_set_interface_lan "eth0"
176 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
177 ucidef_add_switch "switch1" "1" "1"
178 ucidef_add_switch_ports "switch1" \
179 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
183 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
184 ucidef_add_switch "switch0" "1" "1"
185 ucidef_add_switch_ports "switch0" \
186 "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
189 ucidef_add_switch "switch0" "4"
190 ucidef_set_interface_lan "eth0"
196 ucidef_set_interface_lan "eth0.1"
200 ucidef_set_interface_lan "eth0.1"
201 ucidef_add_switch "switch0" "1" "1"
202 ucidef_add_switch_ports "switch0" \
203 "0:lan" "4:lan" "6t@eth0"
206 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
207 ucidef_add_switch "switch0" "1" "1"
208 ucidef_add_switch_ports "switch0" \
209 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
213 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_ports "switch0" \
216 "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
220 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
221 ucidef_add_switch "switch0" "1" "1"
222 ucidef_add_switch_ports "switch0" \
223 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
226 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
227 ucidef_add_switch "switch0" "1" "1"
228 ucidef_add_switch_ports "switch0" \
232 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
233 ucidef_add_switch "switch0" "1" "1"
234 ucidef_add_switch_ports "switch0" \
235 "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
238 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
239 ucidef_add_switch "switch0" "1" "1"
240 ucidef_add_switch_ports "switch0" \
241 "1:lan" "2:lan" "0:wan" "6@eth0"
244 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
245 ucidef_add_switch "switch0" "1" "1"
246 ucidef_add_switch_ports "switch0" \
247 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
250 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
251 if [ -n "${RT3X5X}" ]; then
252 ramips_setup_rt3x5x_vlans
254 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
283 lan_mac=$(cat /sys/class/net/eth0/address)
284 lan_mac=$(macaddr_setbit_la "$lan_mac")
285 wan_mac=$(macaddr_add "$lan_mac" 1)
292 wan_mac=$(mtd_get_mac_binary factory 46)
295 lan_mac=$(cat /sys/class/net/eth0/address)
296 wan_mac=$(mtd_get_mac_binary devdata 7)
300 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
301 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
304 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
307 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
308 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
309 wan_mac=$(macaddr_add "$lan_mac" 1)
312 lan_mac=$(cat /sys/class/net/eth0/address)
316 wan_mac=$(mtd_get_mac_binary factory 4)
317 lan_mac=$(mtd_get_mac_binary factory 46)
323 lan_mac=$(cat /sys/class/net/eth0/address)
324 lan_mac=$(macaddr_add "$lan_mac" -2)
327 lan_mac=$(mtd_get_mac_binary factory 40)
328 wan_mac=$(mtd_get_mac_binary factory 46)
331 lan_mac=$(cat /sys/class/net/eth0/address)
332 lan_mac=$(macaddr_setbit_la "$lan_mac")
333 wan_mac=$(mtd_get_mac_binary factory 32772)
336 lan_mac=$(cat /sys/class/net/eth0/address)
337 wan_mac=$(macaddr_add "$lan_mac" 3)
340 lan_mac=$(cat /sys/class/net/eth0/address)
341 wan_mac=$(macaddr_add "$lan_mac" 4)
344 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
345 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
348 lan_mac=$(cat /sys/class/net/eth0/address)
349 wan_mac=$(macaddr_add "$lan_mac" 5)
352 wan_mac=$(mtd_get_mac_binary factory 40)
358 wan_mac=$(mtd_get_mac_binary factory 4)
362 lan_mac=$(mtd_get_mac_binary factory 4)
363 wan_mac=$(mtd_get_mac_binary factory 40)
366 local index="$(find_mtd_index "board_data")"
367 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
371 lan_mac=$(cat /sys/class/net/eth0/address)
372 wan_mac=$(macaddr_add "$lan_mac" 1)
376 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
377 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
381 board=$(ramips_board_name)
382 ramips_setup_interfaces $board
383 ramips_setup_macs $board