5 . /lib/functions/uci-defaults.sh
7 ramips_setup_rt3x5x_vlans()
9 if [ ! -x /sbin/swconfig ]; then
11 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
16 for port in 5 4 3 2 1 0; do
17 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
20 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
21 wanports="$port $wanports"
23 lanports="$port $lanports"
26 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
27 ucidef_add_switch "rt305x" "1" "1"
28 ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
29 ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
32 ramips_setup_interfaces()
36 ucidef_set_interface_loopback
50 ucidef_add_switch "switch0" "1" "0"
51 ucidef_set_interface_lan "eth0"
56 ucidef_set_interface_lan "eth0.1"
67 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
71 ucidef_set_interface_lan "eth0.1"
72 ucidef_add_switch "switch0" "1" "1"
73 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
77 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
78 ucidef_add_switch "switch0" "1" "1"
79 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
80 ucidef_add_switch_vlan "switch0" "2" "0 6t"
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"
98 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
99 ucidef_add_switch "switch0" "1" "1"
100 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
101 ucidef_add_switch_vlan "switch0" "2" "0 6t"
105 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
110 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
111 ucidef_add_switch "switch0" "1" "1"
112 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
113 ucidef_add_switch_vlan "switch0" "2" "0 5t"
118 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
119 ucidef_add_switch "switch0" "1" "1"
120 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
121 ucidef_add_switch_vlan "switch0" "2" "4 5t"
125 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
126 ucidef_add_switch "switch0" "1" "1"
127 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
128 ucidef_add_switch_vlan "switch0" "2" "4 8t"
133 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
134 ucidef_add_switch "switch0" "1" "1"
135 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
136 ucidef_add_switch_vlan "switch0" "2" "0t 5"
140 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
146 ucidef_set_interface_lan "eth0"
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
155 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
156 if [ -n "${RT3X5X}" ]; then
157 ramips_setup_rt3x5x_vlans
159 ucidef_set_interfaces_lan_wan "eth0" "eth1"
175 lan_mac=$(mtd_get_mac_binary factory 40)
198 lan_mac=$(mtd_get_mac_binary factory 4)
199 wan_mac=$(macaddr_add "$lan_mac" 1)
203 lan_mac=$(mtd_get_mac_binary devdata 16388)
207 lan_mac=$(mtd_get_mac_binary factory 4)
208 wan_mac=$(macaddr_add "$lan_mac" 5)
215 lan_mac=$(mtd_get_mac_binary factory 40)
216 wan_mac=$(macaddr_add "$lan_mac" 1)
223 lan_mac=$(mtd_get_mac_binary devdata 16388)
224 wan_mac=$(macaddr_add "$lan_mac" 1)
228 lan_mac=$(mtd_get_mac_binary factory 4)
229 lan_mac=$(macaddr_setbit_la "$lan_mac")
230 wan_mac=$(macaddr_add "$lan_mac" 1)
234 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
235 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
241 lan_mac=$(mtd_get_mac_binary devdata 16388)
242 wan_mac=$(macaddr_add "$lan_mac" 1)
249 lan_mac=$(mtd_get_mac_binary factory 4)
250 lan_mac=$(macaddr_add "$lan_mac" -1)
255 lan_mac=$(mtd_get_mac_binary factory 4)
256 wan_mac=$(mtd_get_mac_binary factory 40)
260 lan_mac=$(mtd_get_mac_binary factory 40)
264 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
265 wan_mac=$(macaddr_add "$lan_mac" 1)
269 lan_mac=$(mtd_get_mac_binary factory 4)
270 wan_mac=$(mtd_get_mac_binary factory 32772)
274 lan_mac=$(mtd_get_mac_binary factory 40)
275 wan_mac=$(macaddr_add "$lan_mac" 3)
279 lan_mac=$(mtd_get_mac_binary factory 40)
280 wan_mac=$(macaddr_add "$lan_mac" 4)
288 lan_mac=$(mtd_get_mac_binary factory 40)
289 wan_mac=$(mtd_get_mac_binary factory 46)
293 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
294 wan_mac=$(macaddr_add "$lan_mac" 1)
299 lan_mac=$(mtd_get_mac_binary factory 4)
304 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
305 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
308 [ -e /etc/config/network ] && exit 0
310 touch /etc/config/network
312 board=$(ramips_board_name)
314 ramips_setup_interfaces $board
315 ramips_setup_macs $board