5 . /lib/functions/uci-defaults.sh
7 if [ ! -x /usr/sbin/maccalc ]; then
8 echo "$0: maccalc not found!"
12 ramips_setup_rt3x5x_vlans()
14 if [ ! -x /sbin/swconfig ]; then
16 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
21 swconfig dev rt305x set reset 1
22 for port in 5 4 3 2 1 0; do
23 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
26 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
27 wanports="$port $wanports"
29 lanports="$port $lanports"
32 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
33 ucidef_add_switch "rt305x" "1" "1"
34 ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
35 ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
38 ramips_setup_interfaces()
42 ucidef_set_interface_loopback
49 ucidef_add_switch "switch0" "1" "0"
50 ucidef_set_interface_lan "eth0"
55 ucidef_set_interface_lan "eth0.1"
66 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
70 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
71 ucidef_add_switch "switch0" "1" "1"
72 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
73 ucidef_add_switch_vlan "switch0" "2" "0 6t"
77 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
78 ucidef_add_switch "switch0" "1" "1"
79 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
80 ucidef_add_switch_vlan "switch0" "2" "4 6t"
86 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
91 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
92 ucidef_add_switch "switch0" "1" "1"
93 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
94 ucidef_add_switch_vlan "switch0" "2" "0 5t"
99 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
100 ucidef_add_switch "switch0" "1" "1"
101 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
102 ucidef_add_switch_vlan "switch0" "2" "4 5t"
106 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
107 ucidef_add_switch "switch0" "1" "1"
108 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
109 ucidef_add_switch_vlan "switch0" "2" "4 8t"
114 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
115 ucidef_add_switch "switch0" "1" "1"
116 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
117 ucidef_add_switch_vlan "switch0" "2" "0t 5"
122 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
126 ucidef_set_interface_lan "eth0"
130 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
131 if [ -n "${RT3X5X}" ]; then
132 ramips_setup_rt3x5x_vlans
134 ucidef_set_interfaces_lan_wan "eth0" "eth1"
150 lan_mac=$(ramips_get_mac_binary factory 40)
166 lan_mac=$(ramips_get_mac_binary factory 4)
167 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
171 lan_mac=$(ramips_get_mac_binary factory 4)
172 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 5)
177 lan_mac=$(ramips_get_mac_binary factory 40)
178 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
184 lan_mac=$(ramips_get_mac_binary devdata 16388)
185 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
189 lan_mac=$(ramips_get_mac_binary factory 4)
190 lan_mac=$(maccalc or "$lan_mac" "02:00:00:00:00:00")
191 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
195 lan_mac=$(ramips_get_mac_nvram nvram lanmac)
196 wan_mac=$(ramips_get_mac_nvram nvram wanmac)
201 lan_mac=$(ramips_get_mac_binary devdata 16388)
202 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
207 lan_mac=$(ramips_get_mac_binary factory 4)
208 wan_mac=$(ramips_get_mac_binary factory 40)
212 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
213 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
217 lan_mac=$(ramips_get_mac_binary factory 4)
218 wan_mac=$(ramips_get_mac_binary factory 32772)
222 lan_mac=$(ramips_get_mac_binary factory 40)
223 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 3)
227 lan_mac=$(ramips_get_mac_binary factory 40)
228 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 4)
234 lan_mac=$(ramips_get_mac_binary factory 40)
235 wan_mac=$(ramips_get_mac_binary factory 46)
239 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
240 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
244 lan_mac=$(ramips_get_mac_binary factory 4)
249 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
250 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
253 [ -e /etc/config/network ] && exit 0
255 touch /etc/config/network
257 board=$(ramips_board_name)
259 ramips_setup_interfaces $board
260 ramips_setup_macs $board