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"
55 ucidef_set_interface_lan "eth0.1"
65 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
69 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
70 ucidef_add_switch "switch0" "1" "1"
71 ucidef_add_switch_vlan "switch0" "1" "0 6t"
72 ucidef_add_switch_vlan "switch0" "2" "1 6t"
76 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
77 ucidef_add_switch "switch0" "1" "1"
78 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
79 ucidef_add_switch_vlan "switch0" "2" "0 9t"
83 ucidef_set_interface_lan "eth0.1"
84 ucidef_add_switch "switch0" "1" "1"
85 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
89 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
90 ucidef_add_switch "switch0" "1" "1"
91 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
92 ucidef_add_switch_vlan "switch0" "2" "4 9t"
101 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
102 ucidef_add_switch "switch0" "1" "1"
103 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
104 ucidef_add_switch_vlan "switch0" "2" "4 6t"
117 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
118 ucidef_add_switch "switch0" "1" "1"
119 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
120 ucidef_add_switch_vlan "switch0" "2" "0 6t"
124 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
129 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
130 ucidef_add_switch "switch0" "1" "1"
131 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
132 ucidef_add_switch_vlan "switch0" "2" "0 5t"
138 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
139 ucidef_add_switch "switch0" "1" "1"
140 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
141 ucidef_add_switch_vlan "switch0" "2" "4 5t"
145 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
146 ucidef_add_switch "switch0" "1" "1"
147 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
148 ucidef_add_switch_vlan "switch0" "2" "4 8t"
153 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
154 ucidef_add_switch "switch0" "1" "1"
155 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
156 ucidef_add_switch_vlan "switch0" "2" "0t 5"
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 6t"
163 ucidef_add_switch_vlan "switch0" "2" "6t"
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 4 6t"
170 ucidef_add_switch_vlan "switch0" "2" "4 6t"
177 ucidef_set_interface_lan "eth0"
181 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
182 if [ -n "${RT3X5X}" ]; then
183 ramips_setup_rt3x5x_vlans
185 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
199 lan_mac=$(mtd_get_mac_binary devdata 13)
200 wan_mac=$(mtd_get_mac_binary devdata 7)
204 wan_mac=$(macaddr_add "$lan_mac" 5)
208 wan_mac=$(macaddr_add "$lan_mac" 3)
212 wan_mac=$(macaddr_add "$lan_mac" 4)
219 lan_mac=$(macaddr_add "$lan_mac" -1)
223 lan_mac=$(macaddr_setbit_la "$lan_mac")
224 wan_mac=$(macaddr_add "$lan_mac" 1)
229 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
230 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
235 wan_mac=$(mtd_get_mac_binary factory 40)
239 wan_mac=$(mtd_get_mac_binary factory 32772)
247 wan_mac=$(mtd_get_mac_binary factory 46)
251 lan_mac=$(mtd_get_mac_binary board-nvram 65440)
252 wan_mac=$(macaddr_add "$lan_mac" 1)
256 lan_mac=$(mtd_get_mac_binary factory 4)
257 wan_mac=$(macaddr_add "$lan_mac" 1)
261 lan_mac=$(cat /sys/class/net/eth0/address)
262 wan_mac=$(macaddr_add "$lan_mac" 1)
267 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
268 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
271 [ -e /etc/config/network ] && exit 0
273 touch /etc/config/network
275 board=$(ramips_board_name)
277 ramips_setup_interfaces $board
278 ramips_setup_macs $board