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"
54 ucidef_set_interface_lan "eth0.1"
64 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
68 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
69 ucidef_add_switch "switch0" "1" "1"
70 ucidef_add_switch_vlan "switch0" "1" "0 6t"
71 ucidef_add_switch_vlan "switch0" "2" "1 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 9t"
78 ucidef_add_switch_vlan "switch0" "2" "0 9t"
82 ucidef_set_interface_lan "eth0.1"
83 ucidef_add_switch "switch0" "1" "1"
84 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
88 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
89 ucidef_add_switch "switch0" "1" "1"
90 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
91 ucidef_add_switch_vlan "switch0" "2" "4 9t"
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 6t"
103 ucidef_add_switch_vlan "switch0" "2" "4 6t"
115 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
116 ucidef_add_switch "switch0" "1" "1"
117 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
118 ucidef_add_switch_vlan "switch0" "2" "0 6t"
122 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
127 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
128 ucidef_add_switch "switch0" "1" "1"
129 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
130 ucidef_add_switch_vlan "switch0" "2" "0 5t"
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 5t"
139 ucidef_add_switch_vlan "switch0" "2" "4 5t"
143 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
144 ucidef_add_switch "switch0" "1" "1"
145 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
146 ucidef_add_switch_vlan "switch0" "2" "4 8t"
151 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
152 ucidef_add_switch "switch0" "1" "1"
153 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
154 ucidef_add_switch_vlan "switch0" "2" "0t 5"
158 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
159 ucidef_add_switch "switch0" "1" "1"
160 ucidef_add_switch_vlan "switch0" "1" "0 6t"
161 ucidef_add_switch_vlan "switch0" "2" "6t"
168 ucidef_set_interface_lan "eth0"
172 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
173 if [ -n "${RT3X5X}" ]; then
174 ramips_setup_rt3x5x_vlans
176 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
190 lan_mac=$(mtd_get_mac_binary devdata 13)
191 wan_mac=$(mtd_get_mac_binary devdata 7)
195 wan_mac=$(macaddr_add "$lan_mac" 5)
199 wan_mac=$(macaddr_add "$lan_mac" 3)
203 wan_mac=$(macaddr_add "$lan_mac" 4)
210 lan_mac=$(macaddr_add "$lan_mac" -1)
214 lan_mac=$(macaddr_setbit_la "$lan_mac")
215 wan_mac=$(macaddr_add "$lan_mac" 1)
220 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
221 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
226 wan_mac=$(mtd_get_mac_binary factory 40)
230 wan_mac=$(mtd_get_mac_binary factory 32772)
238 wan_mac=$(mtd_get_mac_binary factory 46)
242 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
243 wan_mac=$(macaddr_add "$lan_mac" 1)
247 wan_mac=$(macaddr_add "$lan_mac" 1)
252 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
253 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
256 [ -e /etc/config/network ] && exit 0
258 touch /etc/config/network
260 board=$(ramips_board_name)
262 ramips_setup_interfaces $board
263 ramips_setup_macs $board