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"
87 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
88 ucidef_add_switch "switch0" "1" "1"
89 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
90 ucidef_add_switch_vlan "switch0" "2" "4 6t"
93 ucidef_set_interface_lan "eth0.1"
94 ucidef_add_switch "switch0" "1" "1"
95 ucidef_add_switch_vlan "switch0" "1" "0 6t"
101 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
102 ucidef_add_switch "switch0" "1" "1"
103 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
104 ucidef_add_switch_vlan "switch0" "2" "4 5t"
108 ucidef_set_interface_lan "eth0.1"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
125 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
126 ucidef_add_switch "switch0" "1" "1"
127 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
128 ucidef_add_switch_vlan "switch0" "2" "0 6t"
131 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
132 ucidef_add_switch "switch0" "1" "1"
133 ucidef_add_switch_vlan "switch0" "1" "0 6t"
134 ucidef_add_switch_vlan "switch0" "2" "1 6t"
143 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
147 ucidef_add_switch "switch0" "1" "1"
148 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
149 ucidef_add_switch_vlan "switch0" "2" "0 9t"
152 ucidef_set_interface_lan "eth0.1"
153 ucidef_add_switch "switch0" "1" "1"
154 ucidef_add_switch_vlan "switch0" "1" "4 6t"
157 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
158 ucidef_add_switch "switch0" "1" "1"
159 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
160 ucidef_add_switch_vlan "switch0" "2" "4 9t"
166 ucidef_set_interface_lan "eth0"
170 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
171 ucidef_add_switch "switch1" "1" "1"
172 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
173 ucidef_add_switch_vlan "switch1" "2" "4 6t"
177 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
178 ucidef_add_switch "switch0" "1" "1"
179 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
180 ucidef_add_switch_vlan "switch0" "2" "0 6t"
183 ucidef_add_switch "switch0" "4"
184 ucidef_set_interface_lan "eth0"
190 ucidef_set_interface_lan "eth0.1"
194 ucidef_set_interface_lan "eth0.1"
195 ucidef_add_switch "switch0" "1" "1"
196 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
200 ucidef_add_switch "switch0" "1" "1"
201 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
202 ucidef_add_switch_vlan "switch0" "2" "4 8t"
206 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
207 ucidef_add_switch "switch0" "1" "1"
208 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
209 ucidef_add_switch_vlan "switch0" "2" "0t 5"
213 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
214 ucidef_add_switch "switch0" "1" "1"
215 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
216 ucidef_add_switch_vlan "switch0" "2" "0 5t"
219 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
220 ucidef_add_switch "switch0" "1" "1"
221 ucidef_add_switch_vlan "switch0" "1" "0 6t"
222 ucidef_add_switch_vlan "switch0" "2" "6t"
225 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
226 ucidef_add_switch "switch0" "1" "1"
227 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
228 ucidef_add_switch_vlan "switch0" "2" "5 6t"
231 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
232 ucidef_add_switch "switch0" "1" "1"
233 ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
234 ucidef_add_switch_vlan "switch0" "2" "0 6t"
237 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
238 ucidef_add_switch "switch0" "1" "1"
239 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
240 ucidef_add_switch_vlan "switch0" "2" "4 6t"
243 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
244 if [ -n "${RT3X5X}" ]; then
245 ramips_setup_rt3x5x_vlans
247 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
276 lan_mac=$(cat /sys/class/net/eth0/address)
277 lan_mac=$(macaddr_setbit_la "$lan_mac")
278 wan_mac=$(macaddr_add "$lan_mac" 1)
285 wan_mac=$(mtd_get_mac_binary factory 46)
288 lan_mac=$(cat /sys/class/net/eth0/address)
289 wan_mac=$(mtd_get_mac_binary devdata 7)
293 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
294 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
297 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
300 lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
301 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
302 wan_mac=$(macaddr_add "$lan_mac" 1)
305 lan_mac=$(cat /sys/class/net/eth0/address)
309 wan_mac=$(mtd_get_mac_binary factory 4)
310 lan_mac=$(mtd_get_mac_binary factory 46)
316 lan_mac=$(cat /sys/class/net/eth0/address)
317 lan_mac=$(macaddr_add "$lan_mac" -2)
320 lan_mac=$(mtd_get_mac_binary factory 40)
321 wan_mac=$(mtd_get_mac_binary factory 46)
324 lan_mac=$(cat /sys/class/net/eth0/address)
325 lan_mac=$(macaddr_setbit_la "$lan_mac")
326 wan_mac=$(mtd_get_mac_binary factory 32772)
329 lan_mac=$(cat /sys/class/net/eth0/address)
330 wan_mac=$(macaddr_add "$lan_mac" 3)
333 lan_mac=$(cat /sys/class/net/eth0/address)
334 wan_mac=$(macaddr_add "$lan_mac" 4)
337 lan_mac=$(cat /sys/class/net/eth0/address)
338 wan_mac=$(macaddr_add "$lan_mac" 5)
341 wan_mac=$(mtd_get_mac_binary factory 40)
347 wan_mac=$(mtd_get_mac_binary factory 4)
351 lan_mac=$(mtd_get_mac_binary factory 4)
352 wan_mac=$(mtd_get_mac_binary factory 40)
355 local index="$(find_mtd_index "board_data")"
356 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
360 lan_mac=$(cat /sys/class/net/eth0/address)
361 wan_mac=$(macaddr_add "$lan_mac" 1)
365 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
366 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
370 board=$(ramips_board_name)
371 ramips_setup_interfaces $board
372 ramips_setup_macs $board