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 for port in 5 4 3 2 1 0; do
17 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
20 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
21 wanports="$port $wanports"
23 lanports="$port $lanports"
26 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
27 ucidef_add_switch "rt305x" "1" "1"
28 ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
29 ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
32 ramips_setup_interfaces()
36 ucidef_set_interface_loopback
48 ucidef_add_switch "switch0" "1" "0"
49 ucidef_set_interface_lan "eth0"
54 ucidef_set_interface_lan "eth0.1"
65 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
69 ucidef_set_interface_lan "eth0.1"
70 ucidef_add_switch "switch0" "1" "1"
71 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
75 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
76 ucidef_add_switch "switch0" "1" "1"
77 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
78 ucidef_add_switch_vlan "switch0" "2" "0 6t"
86 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
87 ucidef_add_switch "switch0" "1" "1"
88 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
89 ucidef_add_switch_vlan "switch0" "2" "4 6t"
96 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
99 ucidef_add_switch_vlan "switch0" "2" "0 6t"
103 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
108 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
111 ucidef_add_switch_vlan "switch0" "2" "0 5t"
116 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
117 ucidef_add_switch "switch0" "1" "1"
118 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
119 ucidef_add_switch_vlan "switch0" "2" "4 5t"
123 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
124 ucidef_add_switch "switch0" "1" "1"
125 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
126 ucidef_add_switch_vlan "switch0" "2" "4 8t"
131 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
132 ucidef_add_switch "switch0" "1" "1"
133 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
134 ucidef_add_switch_vlan "switch0" "2" "0t 5"
138 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
144 ucidef_set_interface_lan "eth0"
149 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
153 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
154 if [ -n "${RT3X5X}" ]; then
155 ramips_setup_rt3x5x_vlans
157 ucidef_set_interfaces_lan_wan "eth0" "eth1"
173 lan_mac=$(mtd_get_mac_binary factory 40)
196 lan_mac=$(mtd_get_mac_binary factory 4)
197 wan_mac=$(macaddr_add "$lan_mac" 1)
201 lan_mac=$(mtd_get_mac_binary devdata 16388)
205 lan_mac=$(mtd_get_mac_binary factory 4)
206 wan_mac=$(macaddr_add "$lan_mac" 5)
213 lan_mac=$(mtd_get_mac_binary factory 40)
214 wan_mac=$(macaddr_add "$lan_mac" 1)
221 lan_mac=$(mtd_get_mac_binary devdata 16388)
222 wan_mac=$(macaddr_add "$lan_mac" 1)
226 lan_mac=$(mtd_get_mac_binary factory 4)
227 lan_mac=$(macaddr_setbit_la "$lan_mac")
228 wan_mac=$(macaddr_add "$lan_mac" 1)
232 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
233 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
239 lan_mac=$(mtd_get_mac_binary devdata 16388)
240 wan_mac=$(macaddr_add "$lan_mac" 1)
247 lan_mac=$(mtd_get_mac_binary factory 4)
248 lan_mac=$(macaddr_add "$lan_mac" -1)
253 lan_mac=$(mtd_get_mac_binary factory 4)
254 wan_mac=$(mtd_get_mac_binary factory 40)
258 lan_mac=$(mtd_get_mac_binary factory 40)
262 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
263 wan_mac=$(macaddr_add "$lan_mac" 1)
267 lan_mac=$(mtd_get_mac_binary factory 4)
268 wan_mac=$(mtd_get_mac_binary factory 32772)
272 lan_mac=$(mtd_get_mac_binary factory 40)
273 wan_mac=$(macaddr_add "$lan_mac" 3)
277 lan_mac=$(mtd_get_mac_binary factory 40)
278 wan_mac=$(macaddr_add "$lan_mac" 4)
286 lan_mac=$(mtd_get_mac_binary factory 40)
287 wan_mac=$(mtd_get_mac_binary factory 46)
291 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
292 wan_mac=$(macaddr_add "$lan_mac" 1)
297 lan_mac=$(mtd_get_mac_binary factory 4)
302 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
303 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
306 [ -e /etc/config/network ] && exit 0
308 touch /etc/config/network
310 board=$(ramips_board_name)
312 ramips_setup_interfaces $board
313 ramips_setup_macs $board