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 swconfig dev rt305x
set reset 1
17 for port
in 5 4 3 2 1 0; do
18 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
21 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
22 wanports
="$port $wanports"
24 lanports
="$port $lanports"
27 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
28 ucidef_add_switch
"rt305x" "1" "1"
29 ucidef_add_switch_vlan
"rt305x" "1" "$lanports 6t"
30 ucidef_add_switch_vlan
"rt305x" "2" "$wanports 6t"
33 ramips_setup_interfaces
()
37 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"
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 6t"
94 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
98 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
103 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
104 ucidef_add_switch
"switch0" "1" "1"
105 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
106 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
111 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
112 ucidef_add_switch
"switch0" "1" "1"
113 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
114 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
118 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
119 ucidef_add_switch
"switch0" "1" "1"
120 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
121 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
126 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
127 ucidef_add_switch
"switch0" "1" "1"
128 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
129 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
133 ucidef_set_interfaces_lan_wan
"eth0.2" "eth0.1"
139 ucidef_set_interface_lan
"eth0"
143 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
144 if [ -n "${RT3X5X}" ]; then
145 ramips_setup_rt3x5x_vlans
147 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
163 lan_mac
=$
(mtd_get_mac_binary factory
40)
181 lan_mac
=$
(mtd_get_mac_binary factory
4)
182 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
186 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
190 lan_mac
=$
(mtd_get_mac_binary factory
4)
191 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
196 lan_mac
=$
(mtd_get_mac_binary factory
40)
197 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
203 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
204 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
208 lan_mac
=$
(mtd_get_mac_binary factory
4)
209 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
210 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
214 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
215 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
221 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
222 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
227 lan_mac
=$
(mtd_get_mac_binary factory
4)
228 wan_mac
=$
(mtd_get_mac_binary factory
40)
232 lan_mac
=$
(mtd_get_mac_binary factory
40)
236 lan_mac
=$
(mtd_get_mac_binary
"u-boot" 262148)
237 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
241 lan_mac
=$
(mtd_get_mac_binary factory
4)
242 wan_mac
=$
(mtd_get_mac_binary factory
32772)
246 lan_mac
=$
(mtd_get_mac_binary factory
40)
247 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
251 lan_mac
=$
(mtd_get_mac_binary factory
40)
252 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
260 lan_mac
=$
(mtd_get_mac_binary factory
40)
261 wan_mac
=$
(mtd_get_mac_binary factory
46)
265 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
266 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
271 lan_mac
=$
(mtd_get_mac_binary factory
4)
276 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
277 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
280 [ -e /etc
/config
/network
] && exit 0
282 touch /etc
/config
/network
284 board
=$
(ramips_board_name
)
286 ramips_setup_interfaces
$board
287 ramips_setup_macs
$board