5 . /lib/functions/uci-defaults-new.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
41 ucidef_set_interface_lan "eth0.1"
42 ucidef_add_switch "switch0" "1" "1"
43 ucidef_add_switch_vlan "switch0" "1" "0 6t"
55 ucidef_add_switch "switch0" "1" "0"
56 ucidef_set_interface_lan "eth0"
61 ucidef_set_interface_lan "eth0.2"
67 ucidef_set_interface_lan "eth0.1"
76 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
80 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
81 ucidef_add_switch "switch0" "1" "1"
82 ucidef_add_switch_vlan "switch0" "1" "0 6t"
83 ucidef_add_switch_vlan "switch0" "2" "1 6t"
87 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
88 ucidef_add_switch "switch0" "1" "1"
89 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
90 ucidef_add_switch_vlan "switch0" "2" "0 9t"
94 ucidef_set_interface_lan "eth0.1"
95 ucidef_add_switch "switch0" "1" "1"
96 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
100 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
101 ucidef_add_switch "switch0" "1" "1"
102 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
103 ucidef_add_switch_vlan "switch0" "2" "4 9t"
107 ucidef_set_interface_lan "eth0.1"
108 ucidef_add_switch "switch0" "1" "1"
109 ucidef_add_switch_vlan "switch0" "1" "4 6t"
121 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
122 ucidef_add_switch "switch0" "1" "1"
123 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
124 ucidef_add_switch_vlan "switch0" "2" "4 6t"
139 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
140 ucidef_add_switch "switch0" "1" "1"
141 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
142 ucidef_add_switch_vlan "switch0" "2" "0 6t"
146 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_add_switch "switch0" "1" "1"
153 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
154 ucidef_add_switch_vlan "switch0" "2" "0 5t"
160 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
161 ucidef_add_switch "switch0" "1" "1"
162 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
163 ucidef_add_switch_vlan "switch0" "2" "4 5t"
167 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
168 ucidef_add_switch "switch0" "1" "1"
169 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
170 ucidef_add_switch_vlan "switch0" "2" "4 8t"
175 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
176 ucidef_add_switch "switch0" "1" "1"
177 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
178 ucidef_add_switch_vlan "switch0" "2" "0t 5"
182 ucidef_set_interface_lan "eth0.1"
183 ucidef_add_switch "switch0" "1" "1"
184 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
188 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
189 ucidef_add_switch "switch0" "1" "1"
190 ucidef_add_switch_vlan "switch0" "1" "0 6t"
191 ucidef_add_switch_vlan "switch0" "2" "6t"
195 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
196 ucidef_add_switch "switch0" "1" "1"
197 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
198 ucidef_add_switch_vlan "switch0" "2" "4 6t"
203 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
204 ucidef_add_switch "switch0" "1" "1"
205 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
206 ucidef_add_switch_vlan "switch0" "2" "0 6t"
212 ucidef_set_interface_lan "eth0"
216 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
217 if [ -n "${RT3X5X}" ]; then
218 ramips_setup_rt3x5x_vlans
220 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
234 lan_mac=$(cat /sys/class/net/eth0/address)
235 wan_mac=$(mtd_get_mac_binary devdata 7)
239 lan_mac=$(cat /sys/class/net/eth0/address)
240 wan_mac=$(macaddr_add "$lan_mac" 5)
244 lan_mac=$(cat /sys/class/net/eth0/address)
245 wan_mac=$(macaddr_add "$lan_mac" 3)
249 lan_mac=$(cat /sys/class/net/eth0/address)
250 wan_mac=$(macaddr_add "$lan_mac" 4)
257 lan_mac=$(cat /sys/class/net/eth0/address)
258 lan_mac=$(macaddr_add "$lan_mac" -2)
278 lan_mac=$(cat /sys/class/net/eth0/address)
279 lan_mac=$(macaddr_setbit_la "$lan_mac")
280 wan_mac=$(macaddr_add "$lan_mac" 1)
285 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
286 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
290 wan_mac=$(mtd_get_mac_binary factory 40)
294 lan_mac=$(cat /sys/class/net/eth0/address)
295 lan_mac=$(macaddr_setbit_la "$lan_mac")
296 wan_mac=$(mtd_get_mac_binary factory 32772)
304 wan_mac=$(mtd_get_mac_binary factory 46)
308 lan_mac=$(cat /sys/class/net/eth0/address)
309 wan_mac=$(macaddr_add "$lan_mac" 1)
314 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
315 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
319 board=$(ramips_board_name)
320 ramips_setup_interfaces $board
321 ramips_setup_macs $board