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
47 ucidef_add_switch "switch0" "1" "0"
48 ucidef_set_interface_lan "eth0"
53 ucidef_set_interface_lan "eth0.1"
64 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
68 ucidef_set_interface_lan "eth0.1"
69 ucidef_add_switch "switch0" "1" "1"
70 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
74 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
75 ucidef_add_switch "switch0" "1" "1"
76 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
77 ucidef_add_switch_vlan "switch0" "2" "0 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" "0 1 2 3 6t"
85 ucidef_add_switch_vlan "switch0" "2" "4 6t"
92 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
93 ucidef_add_switch "switch0" "1" "1"
94 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
95 ucidef_add_switch_vlan "switch0" "2" "0 6t"
99 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
104 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
105 ucidef_add_switch "switch0" "1" "1"
106 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
107 ucidef_add_switch_vlan "switch0" "2" "0 5t"
112 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
113 ucidef_add_switch "switch0" "1" "1"
114 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
115 ucidef_add_switch_vlan "switch0" "2" "4 5t"
119 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
120 ucidef_add_switch "switch0" "1" "1"
121 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
122 ucidef_add_switch_vlan "switch0" "2" "4 8t"
127 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
128 ucidef_add_switch "switch0" "1" "1"
129 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
130 ucidef_add_switch_vlan "switch0" "2" "0t 5"
134 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
140 ucidef_set_interface_lan "eth0"
144 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
145 if [ -n "${RT3X5X}" ]; then
146 ramips_setup_rt3x5x_vlans
148 ucidef_set_interfaces_lan_wan "eth0" "eth1"
164 lan_mac=$(mtd_get_mac_binary factory 40)
183 lan_mac=$(mtd_get_mac_binary factory 4)
184 wan_mac=$(macaddr_add "$lan_mac" 1)
188 lan_mac=$(mtd_get_mac_binary devdata 16388)
192 lan_mac=$(mtd_get_mac_binary factory 4)
193 wan_mac=$(macaddr_add "$lan_mac" 5)
199 lan_mac=$(mtd_get_mac_binary factory 40)
200 wan_mac=$(macaddr_add "$lan_mac" 1)
206 lan_mac=$(mtd_get_mac_binary devdata 16388)
207 wan_mac=$(macaddr_add "$lan_mac" 1)
211 lan_mac=$(mtd_get_mac_binary factory 4)
212 lan_mac=$(macaddr_setbit_la "$lan_mac")
213 wan_mac=$(macaddr_add "$lan_mac" 1)
217 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
218 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
224 lan_mac=$(mtd_get_mac_binary devdata 16388)
225 wan_mac=$(macaddr_add "$lan_mac" 1)
230 lan_mac=$(mtd_get_mac_binary factory 4)
231 wan_mac=$(mtd_get_mac_binary factory 40)
235 lan_mac=$(mtd_get_mac_binary factory 40)
239 lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
240 wan_mac=$(macaddr_add "$lan_mac" 1)
244 lan_mac=$(mtd_get_mac_binary factory 4)
245 wan_mac=$(mtd_get_mac_binary factory 32772)
249 lan_mac=$(mtd_get_mac_binary factory 40)
250 wan_mac=$(macaddr_add "$lan_mac" 3)
254 lan_mac=$(mtd_get_mac_binary factory 40)
255 wan_mac=$(macaddr_add "$lan_mac" 4)
263 lan_mac=$(mtd_get_mac_binary factory 40)
264 wan_mac=$(mtd_get_mac_binary factory 46)
268 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
269 wan_mac=$(macaddr_add "$lan_mac" 1)
274 lan_mac=$(mtd_get_mac_binary factory 4)
279 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
280 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
283 [ -e /etc/config/network ] && exit 0
285 touch /etc/config/network
287 board=$(ramips_board_name)
289 ramips_setup_interfaces $board
290 ramips_setup_macs $board