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"
56 ucidef_add_switch_attr "switch0" "reset" "false"
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_ports "switch0" \
93 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
96 ucidef_set_interface_lan "eth0.1"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_ports "switch0" \
105 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
106 ucidef_add_switch "switch0" "1" "1"
107 ucidef_add_switch_ports "switch0" \
108 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
113 ucidef_set_interface_lan "eth0.1"
114 ucidef_add_switch "switch0" "1" "1"
115 ucidef_add_switch_ports "switch0" \
116 "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
131 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
132 ucidef_add_switch "switch0" "1" "1"
133 ucidef_add_switch_ports "switch0" \
134 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
137 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138 ucidef_add_switch "switch0" "1" "1"
139 ucidef_add_switch_ports "switch0" \
140 "0:lan" "1:wan" "6@eth0"
149 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153 ucidef_add_switch "switch0" "1" "1"
154 ucidef_add_switch_ports "switch0" \
155 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
158 ucidef_set_interface_lan "eth0.1"
159 ucidef_add_switch "switch0" "1" "1"
160 ucidef_add_switch_ports "switch0" \
164 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_ports "switch0" \
167 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
173 ucidef_set_interface_lan "eth0"
177 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
178 ucidef_add_switch "switch1" "1" "1"
179 ucidef_add_switch_ports "switch1" \
180 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
184 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
185 ucidef_add_switch "switch0" "1" "1"
186 ucidef_add_switch_ports "switch0" \
187 "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
190 ucidef_add_switch "switch0"
191 ucidef_add_switch_attr "switch0" "reset" "false"
192 ucidef_set_interface_lan "eth0"
198 ucidef_set_interface_lan "eth0.1"
202 ucidef_set_interface_lan "eth0.1"
203 ucidef_add_switch "switch0" "1" "1"
204 ucidef_add_switch_ports "switch0" \
205 "0:lan" "4:lan" "6t@eth0"
208 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
209 ucidef_add_switch "switch0" "1" "1"
210 ucidef_add_switch_ports "switch0" \
211 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
215 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
216 ucidef_add_switch "switch0" "1" "1"
217 ucidef_add_switch_ports "switch0" \
218 "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
222 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
223 ucidef_add_switch "switch0" "1" "1"
224 ucidef_add_switch_ports "switch0" \
225 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
228 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
229 ucidef_add_switch "switch0" "1" "1"
230 ucidef_add_switch_ports "switch0" \
234 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
235 ucidef_add_switch "switch0" "1" "1"
236 ucidef_add_switch_ports "switch0" \
237 "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
240 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
241 ucidef_add_switch "switch0" "1" "1"
242 ucidef_add_switch_ports "switch0" \
243 "1:lan" "2:lan" "0:wan" "6@eth0"
246 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
247 ucidef_add_switch "switch0" "1" "1"
248 ucidef_add_switch_ports "switch0" \
249 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
252 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
253 if [ -n "${RT3X5X}" ]; then
254 ramips_setup_rt3x5x_vlans
256 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
285 lan_mac=$(cat /sys/class/net/eth0/address)
286 lan_mac=$(macaddr_setbit_la "$lan_mac")
287 wan_mac=$(macaddr_add "$lan_mac" 1)
294 wan_mac=$(mtd_get_mac_binary factory 46)
297 lan_mac=$(cat /sys/class/net/eth0/address)
298 wan_mac=$(mtd_get_mac_binary devdata 7)
302 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
303 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
306 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
309 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
310 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
311 wan_mac=$(macaddr_add "$lan_mac" 1)
314 lan_mac=$(cat /sys/class/net/eth0/address)
318 wan_mac=$(mtd_get_mac_binary factory 4)
319 lan_mac=$(mtd_get_mac_binary factory 46)
325 lan_mac=$(cat /sys/class/net/eth0/address)
326 lan_mac=$(macaddr_add "$lan_mac" -2)
329 lan_mac=$(mtd_get_mac_binary factory 40)
330 wan_mac=$(mtd_get_mac_binary factory 46)
333 lan_mac=$(cat /sys/class/net/eth0/address)
334 lan_mac=$(macaddr_setbit_la "$lan_mac")
335 wan_mac=$(mtd_get_mac_binary factory 32772)
338 lan_mac=$(cat /sys/class/net/eth0/address)
339 wan_mac=$(macaddr_add "$lan_mac" 3)
342 lan_mac=$(cat /sys/class/net/eth0/address)
343 wan_mac=$(macaddr_add "$lan_mac" 4)
346 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
347 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
350 lan_mac=$(cat /sys/class/net/eth0/address)
351 wan_mac=$(macaddr_add "$lan_mac" 5)
354 wan_mac=$(mtd_get_mac_binary factory 40)
360 wan_mac=$(mtd_get_mac_binary factory 4)
364 lan_mac=$(mtd_get_mac_binary factory 4)
365 wan_mac=$(mtd_get_mac_binary factory 40)
368 local index="$(find_mtd_index "board_data")"
369 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
373 lan_mac=$(cat /sys/class/net/eth0/address)
374 wan_mac=$(macaddr_add "$lan_mac" 1)
378 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
379 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
383 board=$(ramips_board_name)
384 ramips_setup_interfaces $board
385 ramips_setup_macs $board