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"
129 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
130 ucidef_add_switch "switch0" "1" "1"
131 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
132 ucidef_add_switch_vlan "switch0" "2" "4 6t"
136 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
137 ucidef_add_switch "switch0" "1" "1"
138 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
139 ucidef_add_switch_vlan "switch0" "2" "5 6t"
154 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
155 ucidef_add_switch "switch0" "1" "1"
156 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
157 ucidef_add_switch_vlan "switch0" "2" "0 6t"
161 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
166 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
167 ucidef_add_switch "switch0" "1" "1"
168 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
169 ucidef_add_switch_vlan "switch0" "2" "0 5t"
176 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
177 ucidef_add_switch "switch0" "1" "1"
178 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
179 ucidef_add_switch_vlan "switch0" "2" "4 5t"
183 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
184 ucidef_add_switch "switch0" "1" "1"
185 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
186 ucidef_add_switch_vlan "switch0" "2" "4 8t"
191 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
192 ucidef_add_switch "switch0" "1" "1"
193 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
194 ucidef_add_switch_vlan "switch0" "2" "0t 5"
198 ucidef_set_interface_lan "eth0.1"
199 ucidef_add_switch "switch0" "1" "1"
200 ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
204 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
205 ucidef_add_switch "switch0" "1" "1"
206 ucidef_add_switch_vlan "switch0" "1" "0 6t"
207 ucidef_add_switch_vlan "switch0" "2" "6t"
211 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
212 ucidef_add_switch "switch0" "1" "1"
213 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
214 ucidef_add_switch_vlan "switch0" "2" "4 6t"
218 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
219 ucidef_add_switch "switch0" "1" "1"
220 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
221 ucidef_add_switch_vlan "switch0" "2" "0 6t"
227 ucidef_set_interface_lan "eth0"
232 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
233 ucidef_add_switch "switch1" "1" "1"
234 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
235 ucidef_add_switch_vlan "switch1" "2" "4 6t"
239 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
240 if [ -n "${RT3X5X}" ]; then
241 ramips_setup_rt3x5x_vlans
243 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
257 lan_mac=$(cat /sys/class/net/eth0/address)
258 wan_mac=$(mtd_get_mac_binary devdata 7)
262 lan_mac=$(cat /sys/class/net/eth0/address)
263 wan_mac=$(macaddr_add "$lan_mac" 5)
267 lan_mac=$(cat /sys/class/net/eth0/address)
268 wan_mac=$(macaddr_add "$lan_mac" 3)
272 lan_mac=$(cat /sys/class/net/eth0/address)
273 wan_mac=$(macaddr_add "$lan_mac" 4)
280 lan_mac=$(cat /sys/class/net/eth0/address)
281 lan_mac=$(macaddr_add "$lan_mac" -2)
301 lan_mac=$(cat /sys/class/net/eth0/address)
302 lan_mac=$(macaddr_setbit_la "$lan_mac")
303 wan_mac=$(macaddr_add "$lan_mac" 1)
308 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
309 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
313 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
317 wan_mac=$(mtd_get_mac_binary factory 40)
321 lan_mac=$(cat /sys/class/net/eth0/address)
322 lan_mac=$(macaddr_setbit_la "$lan_mac")
323 wan_mac=$(mtd_get_mac_binary factory 32772)
331 wan_mac=$(mtd_get_mac_binary factory 46)
335 lan_mac=$(cat /sys/class/net/eth0/address)
336 wan_mac=$(macaddr_add "$lan_mac" 1)
341 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
342 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
346 board=$(ramips_board_name)
347 ramips_setup_interfaces $board
348 ramips_setup_macs $board