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"
86 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
87 ucidef_add_switch "switch0" "1" "1"
88 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
89 ucidef_add_switch_vlan "switch0" "2" "0 5t"
94 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
95 ucidef_add_switch "switch0" "1" "1"
96 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
97 ucidef_add_switch_vlan "switch0" "2" "4 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 8t"
104 ucidef_add_switch_vlan "switch0" "2" "4 8t"
109 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
110 ucidef_add_switch "switch0" "1" "1"
111 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
112 ucidef_add_switch_vlan "switch0" "2" "0t 5"
117 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
122 ucidef_set_interface_lan "eth0"
126 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
127 if [ -n "${RT3X5X}" ]; then
128 ramips_setup_rt3x5x_vlans
130 ucidef_set_interfaces_lan_wan "eth0" "eth1"
146 lan_mac=$(mtd_get_mac_binary factory 40)
162 lan_mac=$(mtd_get_mac_binary factory 4)
163 wan_mac=$(macaddr_add "$lan_mac" 1)
167 lan_mac=$(mtd_get_mac_binary factory 4)
168 wan_mac=$(macaddr_add "$lan_mac" 5)
173 lan_mac=$(mtd_get_mac_binary factory 40)
174 wan_mac=$(macaddr_add "$lan_mac" 1)
180 lan_mac=$(mtd_get_mac_binary devdata 16388)
181 wan_mac=$(macaddr_add "$lan_mac" 1)
185 lan_mac=$(mtd_get_mac_binary factory 4)
186 lan_mac=$(macaddr_setbit_la "$lan_mac")
187 wan_mac=$(macaddr_add "$lan_mac" 1)
191 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
192 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
197 lan_mac=$(mtd_get_mac_binary devdata 16388)
198 wan_mac=$(macaddr_add "$lan_mac" 1)
203 lan_mac=$(mtd_get_mac_binary factory 4)
204 wan_mac=$(mtd_get_mac_binary factory 40)
208 lan_mac=$(mtd_get_mac_binary factory 40)
212 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
213 wan_mac=$(macaddr_add "$lan_mac" 1)
217 lan_mac=$(mtd_get_mac_binary factory 4)
218 wan_mac=$(mtd_get_mac_binary factory 32772)
222 lan_mac=$(mtd_get_mac_binary factory 40)
223 wan_mac=$(macaddr_add "$lan_mac" 3)
227 lan_mac=$(mtd_get_mac_binary factory 40)
228 wan_mac=$(macaddr_add "$lan_mac" 4)
234 lan_mac=$(mtd_get_mac_binary factory 40)
235 wan_mac=$(mtd_get_mac_binary factory 46)
239 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
240 wan_mac=$(macaddr_add "$lan_mac" 1)
244 lan_mac=$(mtd_get_mac_binary factory 4)
249 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
250 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
253 [ -e /etc/config/network ] && exit 0
255 touch /etc/config/network
257 board=$(ramips_board_name)
259 ramips_setup_interfaces $board
260 ramips_setup_macs $board