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"
51 ucidef_set_interface_lan "eth0.1"
62 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
66 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
67 ucidef_add_switch "switch0" "1" "1"
68 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
69 ucidef_add_switch_vlan "switch0" "2" "0 6t"
73 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
74 ucidef_add_switch "switch0" "1" "1"
75 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
76 ucidef_add_switch_vlan "switch0" "2" "4 6t"
82 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
83 ucidef_add_switch "switch0" "1" "1"
84 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
85 ucidef_add_switch_vlan "switch0" "2" "0 6t"
89 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
94 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
95 ucidef_add_switch "switch0" "1" "1"
96 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
97 ucidef_add_switch_vlan "switch0" "2" "0 5t"
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"
109 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
110 ucidef_add_switch "switch0" "1" "1"
111 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
112 ucidef_add_switch_vlan "switch0" "2" "4 8t"
117 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
118 ucidef_add_switch "switch0" "1" "1"
119 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
120 ucidef_add_switch_vlan "switch0" "2" "0t 5"
125 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
131 ucidef_set_interface_lan "eth0"
135 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
136 if [ -n "${RT3X5X}" ]; then
137 ramips_setup_rt3x5x_vlans
139 ucidef_set_interfaces_lan_wan "eth0" "eth1"
155 lan_mac=$(mtd_get_mac_binary factory 40)
171 lan_mac=$(mtd_get_mac_binary factory 4)
172 wan_mac=$(macaddr_add "$lan_mac" 1)
176 lan_mac=$(mtd_get_mac_binary factory 4)
177 wan_mac=$(macaddr_add "$lan_mac" 5)
182 lan_mac=$(mtd_get_mac_binary factory 40)
183 wan_mac=$(macaddr_add "$lan_mac" 1)
189 lan_mac=$(mtd_get_mac_binary devdata 16388)
190 wan_mac=$(macaddr_add "$lan_mac" 1)
194 lan_mac=$(mtd_get_mac_binary factory 4)
195 lan_mac=$(macaddr_setbit_la "$lan_mac")
196 wan_mac=$(macaddr_add "$lan_mac" 1)
200 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
201 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
207 lan_mac=$(mtd_get_mac_binary devdata 16388)
208 wan_mac=$(macaddr_add "$lan_mac" 1)
213 lan_mac=$(mtd_get_mac_binary factory 4)
214 wan_mac=$(mtd_get_mac_binary factory 40)
218 lan_mac=$(mtd_get_mac_binary factory 40)
222 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
223 wan_mac=$(macaddr_add "$lan_mac" 1)
227 lan_mac=$(mtd_get_mac_binary factory 4)
228 wan_mac=$(mtd_get_mac_binary factory 32772)
232 lan_mac=$(mtd_get_mac_binary factory 40)
233 wan_mac=$(macaddr_add "$lan_mac" 3)
237 lan_mac=$(mtd_get_mac_binary factory 40)
238 wan_mac=$(macaddr_add "$lan_mac" 4)
244 lan_mac=$(mtd_get_mac_binary factory 40)
245 wan_mac=$(mtd_get_mac_binary factory 46)
249 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
250 wan_mac=$(macaddr_add "$lan_mac" 1)
255 lan_mac=$(mtd_get_mac_binary factory 4)
260 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
261 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
264 [ -e /etc/config/network ] && exit 0
266 touch /etc/config/network
268 board=$(ramips_board_name)
270 ramips_setup_interfaces $board
271 ramips_setup_macs $board