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 swconfig dev rt305x set reset 1
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
44 ucidef_add_switch "switch0" "1" "0"
45 ucidef_set_interface_lan "eth0"
50 ucidef_set_interface_lan "eth0.1"
61 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
65 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
66 ucidef_add_switch "switch0" "1" "1"
67 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
68 ucidef_add_switch_vlan "switch0" "2" "0 6t"
72 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
73 ucidef_add_switch "switch0" "1" "1"
74 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
75 ucidef_add_switch_vlan "switch0" "2" "4 6t"
81 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
82 ucidef_add_switch "switch0" "1" "1"
83 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
84 ucidef_add_switch_vlan "switch0" "2" "0 6t"
88 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
93 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
94 ucidef_add_switch "switch0" "1" "1"
95 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
96 ucidef_add_switch_vlan "switch0" "2" "0 5t"
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_interfaces_lan_wan "eth0.1" "eth0.2"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
111 ucidef_add_switch_vlan "switch0" "2" "4 8t"
116 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
117 ucidef_add_switch "switch0" "1" "1"
118 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
119 ucidef_add_switch_vlan "switch0" "2" "0t 5"
124 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
129 ucidef_set_interface_lan "eth0"
133 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
134 if [ -n "${RT3X5X}" ]; then
135 ramips_setup_rt3x5x_vlans
137 ucidef_set_interfaces_lan_wan "eth0" "eth1"
153 lan_mac=$(mtd_get_mac_binary factory 40)
169 lan_mac=$(mtd_get_mac_binary factory 4)
170 wan_mac=$(macaddr_add "$lan_mac" 1)
174 lan_mac=$(mtd_get_mac_binary factory 4)
175 wan_mac=$(macaddr_add "$lan_mac" 5)
180 lan_mac=$(mtd_get_mac_binary factory 40)
181 wan_mac=$(macaddr_add "$lan_mac" 1)
187 lan_mac=$(mtd_get_mac_binary devdata 16388)
188 wan_mac=$(macaddr_add "$lan_mac" 1)
192 lan_mac=$(mtd_get_mac_binary factory 4)
193 lan_mac=$(macaddr_setbit_la "$lan_mac")
194 wan_mac=$(macaddr_add "$lan_mac" 1)
198 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
199 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
205 lan_mac=$(mtd_get_mac_binary devdata 16388)
206 wan_mac=$(macaddr_add "$lan_mac" 1)
211 lan_mac=$(mtd_get_mac_binary factory 4)
212 wan_mac=$(mtd_get_mac_binary factory 40)
216 lan_mac=$(mtd_get_mac_binary factory 40)
220 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
221 wan_mac=$(macaddr_add "$lan_mac" 1)
225 lan_mac=$(mtd_get_mac_binary factory 4)
226 wan_mac=$(mtd_get_mac_binary factory 32772)
230 lan_mac=$(mtd_get_mac_binary factory 40)
231 wan_mac=$(macaddr_add "$lan_mac" 3)
235 lan_mac=$(mtd_get_mac_binary factory 40)
236 wan_mac=$(macaddr_add "$lan_mac" 4)
242 lan_mac=$(mtd_get_mac_binary factory 40)
243 wan_mac=$(mtd_get_mac_binary factory 46)
247 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
248 wan_mac=$(macaddr_add "$lan_mac" 1)
252 lan_mac=$(mtd_get_mac_binary factory 4)
257 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
258 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
261 [ -e /etc/config/network ] && exit 0
263 touch /etc/config/network
265 board=$(ramips_board_name)
267 ramips_setup_interfaces $board
268 ramips_setup_macs $board