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
46 ucidef_add_switch
"switch0" "1" "0"
47 ucidef_set_interface_lan
"eth0"
52 ucidef_set_interface_lan
"eth0.1"
63 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
67 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
68 ucidef_add_switch
"switch0" "1" "1"
69 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
70 ucidef_add_switch_vlan
"switch0" "2" "0 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" "0 1 2 3 6t"
78 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
84 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
85 ucidef_add_switch
"switch0" "1" "1"
86 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
87 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
91 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
96 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
97 ucidef_add_switch
"switch0" "1" "1"
98 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
99 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
104 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
105 ucidef_add_switch
"switch0" "1" "1"
106 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
107 ucidef_add_switch_vlan
"switch0" "2" "4 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 8t"
114 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
119 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
120 ucidef_add_switch
"switch0" "1" "1"
121 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
122 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
127 ucidef_set_interfaces_lan_wan
"eth0.2" "eth0.1"
133 ucidef_set_interface_lan
"eth0"
137 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
138 if [ -n "${RT3X5X}" ]; then
139 ramips_setup_rt3x5x_vlans
141 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
157 lan_mac
=$
(mtd_get_mac_binary factory
40)
174 lan_mac
=$
(mtd_get_mac_binary factory
4)
175 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
179 lan_mac
=$
(mtd_get_mac_binary factory
4)
180 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
185 lan_mac
=$
(mtd_get_mac_binary factory
40)
186 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
192 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
193 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
197 lan_mac
=$
(mtd_get_mac_binary factory
4)
198 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
199 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
203 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
204 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
210 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
211 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
216 lan_mac
=$
(mtd_get_mac_binary factory
4)
217 wan_mac
=$
(mtd_get_mac_binary factory
40)
221 lan_mac
=$
(mtd_get_mac_binary factory
40)
225 lan_mac
=$
(mtd_get_mac_binary
"u-boot" 262148)
226 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
230 lan_mac
=$
(mtd_get_mac_binary factory
4)
231 wan_mac
=$
(mtd_get_mac_binary factory
32772)
235 lan_mac
=$
(mtd_get_mac_binary factory
40)
236 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
240 lan_mac
=$
(mtd_get_mac_binary factory
40)
241 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
248 lan_mac
=$
(mtd_get_mac_binary factory
40)
249 wan_mac
=$
(mtd_get_mac_binary factory
46)
253 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
254 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
259 lan_mac
=$
(mtd_get_mac_binary factory
4)
264 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
265 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
268 [ -e /etc
/config
/network
] && exit 0
270 touch /etc
/config
/network
272 board
=$
(ramips_board_name
)
274 ramips_setup_interfaces
$board
275 ramips_setup_macs
$board