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"
88 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
89 ucidef_add_switch "switch0" "1" "1"
90 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
91 ucidef_add_switch_vlan "switch0" "2" "4 6t"
94 ucidef_set_interface_lan "eth0.1"
95 ucidef_add_switch "switch0" "1" "1"
96 ucidef_add_switch_vlan "switch0" "1" "0 6t"
102 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
103 ucidef_add_switch "switch0" "1" "1"
104 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
105 ucidef_add_switch_vlan "switch0" "2" "4 5t"
110 ucidef_set_interface_lan "eth0.1"
111 ucidef_add_switch "switch0" "1" "1"
112 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
127 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
128 ucidef_add_switch "switch0" "1" "1"
129 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
130 ucidef_add_switch_vlan "switch0" "2" "0 6t"
133 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
134 ucidef_add_switch "switch0" "1" "1"
135 ucidef_add_switch_vlan "switch0" "1" "0 6t"
136 ucidef_add_switch_vlan "switch0" "2" "1 6t"
145 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
148 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
149 ucidef_add_switch "switch0" "1" "1"
150 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
151 ucidef_add_switch_vlan "switch0" "2" "0 9t"
154 ucidef_set_interface_lan "eth0.1"
155 ucidef_add_switch "switch0" "1" "1"
156 ucidef_add_switch_vlan "switch0" "1" "4 6t"
159 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
160 ucidef_add_switch "switch0" "1" "1"
161 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
162 ucidef_add_switch_vlan "switch0" "2" "4 9t"
168 ucidef_set_interface_lan "eth0"
172 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
173 ucidef_add_switch "switch1" "1" "1"
174 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
175 ucidef_add_switch_vlan "switch1" "2" "4 6t"
179 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
180 ucidef_add_switch "switch0" "1" "1"
181 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
182 ucidef_add_switch_vlan "switch0" "2" "0 6t"
185 ucidef_add_switch "switch0" "4"
186 ucidef_set_interface_lan "eth0"
192 ucidef_set_interface_lan "eth0.1"
196 ucidef_set_interface_lan "eth0.1"
197 ucidef_add_switch "switch0" "1" "1"
198 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
201 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
202 ucidef_add_switch "switch0" "1" "1"
203 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
204 ucidef_add_switch_vlan "switch0" "2" "4 8t"
208 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
209 ucidef_add_switch "switch0" "1" "1"
210 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
211 ucidef_add_switch_vlan "switch0" "2" "0t 5"
215 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
216 ucidef_add_switch "switch0" "1" "1"
217 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
218 ucidef_add_switch_vlan "switch0" "2" "0 5t"
221 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
222 ucidef_add_switch "switch0" "1" "1"
223 ucidef_add_switch_vlan "switch0" "1" "0 6t"
224 ucidef_add_switch_vlan "switch0" "2" "6t"
227 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
228 ucidef_add_switch "switch0" "1" "1"
229 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
230 ucidef_add_switch_vlan "switch0" "2" "5 6t"
233 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
234 ucidef_add_switch "switch0" "1" "1"
235 ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
236 ucidef_add_switch_vlan "switch0" "2" "0 6t"
239 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
240 ucidef_add_switch "switch0" "1" "1"
241 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
242 ucidef_add_switch_vlan "switch0" "2" "4 6t"
245 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
246 if [ -n "${RT3X5X}" ]; then
247 ramips_setup_rt3x5x_vlans
249 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
278 lan_mac=$(cat /sys/class/net/eth0/address)
279 lan_mac=$(macaddr_setbit_la "$lan_mac")
280 wan_mac=$(macaddr_add "$lan_mac" 1)
287 wan_mac=$(mtd_get_mac_binary factory 46)
290 lan_mac=$(cat /sys/class/net/eth0/address)
291 wan_mac=$(mtd_get_mac_binary devdata 7)
295 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
296 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
299 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
302 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
303 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
304 wan_mac=$(macaddr_add "$lan_mac" 1)
307 lan_mac=$(cat /sys/class/net/eth0/address)
311 wan_mac=$(mtd_get_mac_binary factory 4)
312 lan_mac=$(mtd_get_mac_binary factory 46)
318 lan_mac=$(cat /sys/class/net/eth0/address)
319 lan_mac=$(macaddr_add "$lan_mac" -2)
322 lan_mac=$(mtd_get_mac_binary factory 40)
323 wan_mac=$(mtd_get_mac_binary factory 46)
326 lan_mac=$(cat /sys/class/net/eth0/address)
327 lan_mac=$(macaddr_setbit_la "$lan_mac")
328 wan_mac=$(mtd_get_mac_binary factory 32772)
331 lan_mac=$(cat /sys/class/net/eth0/address)
332 wan_mac=$(macaddr_add "$lan_mac" 3)
335 lan_mac=$(cat /sys/class/net/eth0/address)
336 wan_mac=$(macaddr_add "$lan_mac" 4)
339 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
340 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
343 lan_mac=$(cat /sys/class/net/eth0/address)
344 wan_mac=$(macaddr_add "$lan_mac" 5)
347 wan_mac=$(mtd_get_mac_binary factory 40)
353 wan_mac=$(mtd_get_mac_binary factory 4)
357 lan_mac=$(mtd_get_mac_binary factory 4)
358 wan_mac=$(mtd_get_mac_binary factory 40)
361 local index="$(find_mtd_index "board_data")"
362 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
366 lan_mac=$(cat /sys/class/net/eth0/address)
367 wan_mac=$(macaddr_add "$lan_mac" 1)
371 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
372 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
376 board=$(ramips_board_name)
377 ramips_setup_interfaces $board
378 ramips_setup_macs $board