5 . /lib/functions/uci-defaults.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
49 ucidef_add_switch "switch0" "1" "0"
50 ucidef_set_interface_lan "eth0"
55 ucidef_set_interface_lan "eth0.2"
61 ucidef_set_interface_lan "eth0.1"
71 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
75 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
76 ucidef_add_switch "switch0" "1" "1"
77 ucidef_add_switch_vlan "switch0" "1" "0 6t"
78 ucidef_add_switch_vlan "switch0" "2" "1 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 9t"
85 ucidef_add_switch_vlan "switch0" "2" "0 9t"
89 ucidef_set_interface_lan "eth0.1"
90 ucidef_add_switch "switch0" "1" "1"
91 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
95 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
96 ucidef_add_switch "switch0" "1" "1"
97 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
98 ucidef_add_switch_vlan "switch0" "2" "4 9t"
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 6t"
111 ucidef_add_switch_vlan "switch0" "2" "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"
132 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
137 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138 ucidef_add_switch "switch0" "1" "1"
139 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
140 ucidef_add_switch_vlan "switch0" "2" "0 5t"
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
147 ucidef_add_switch "switch0" "1" "1"
148 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
149 ucidef_add_switch_vlan "switch0" "2" "4 5t"
153 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
154 ucidef_add_switch "switch0" "1" "1"
155 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
156 ucidef_add_switch_vlan "switch0" "2" "4 8t"
161 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
162 ucidef_add_switch "switch0" "1" "1"
163 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
164 ucidef_add_switch_vlan "switch0" "2" "0t 5"
168 ucidef_set_interface_lan "eth0.1"
169 ucidef_add_switch "switch0" "1" "1"
170 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
174 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
175 ucidef_add_switch "switch0" "1" "1"
176 ucidef_add_switch_vlan "switch0" "1" "0 6t"
177 ucidef_add_switch_vlan "switch0" "2" "6t"
181 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
182 ucidef_add_switch "switch0" "1" "1"
183 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
184 ucidef_add_switch_vlan "switch0" "2" "4 6t"
191 ucidef_set_interface_lan "eth0"
195 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
196 if [ -n "${RT3X5X}" ]; then
197 ramips_setup_rt3x5x_vlans
199 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
213 lan_mac=$(cat /sys/class/net/eth0/address)
214 wan_mac=$(mtd_get_mac_binary devdata 7)
218 lan_mac=$(cat /sys/class/net/eth0/address)
219 wan_mac=$(macaddr_add "$lan_mac" 5)
223 lan_mac=$(cat /sys/class/net/eth0/address)
224 wan_mac=$(macaddr_add "$lan_mac" 3)
228 lan_mac=$(cat /sys/class/net/eth0/address)
229 wan_mac=$(macaddr_add "$lan_mac" 4)
236 lan_mac=$(cat /sys/class/net/eth0/address)
237 lan_mac=$(macaddr_add "$lan_mac" -2)
253 lan_mac=$(cat /sys/class/net/eth0/address)
254 lan_mac=$(macaddr_setbit_la "$lan_mac")
255 wan_mac=$(macaddr_add "$lan_mac" 1)
260 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
261 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
265 wan_mac=$(mtd_get_mac_binary factory 40)
269 lan_mac=$(cat /sys/class/net/eth0/address)
270 lan_mac=$(macaddr_setbit_la "$lan_mac")
271 wan_mac=$(mtd_get_mac_binary factory 32772)
279 wan_mac=$(mtd_get_mac_binary factory 46)
283 lan_mac=$(cat /sys/class/net/eth0/address)
284 wan_mac=$(macaddr_add "$lan_mac" 1)
289 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
290 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
293 [ -e /etc/config/network ] && exit 0
295 touch /etc/config/network
297 board=$(ramips_board_name)
299 ramips_setup_interfaces $board
300 ramips_setup_macs $board