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"
66 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
70 ucidef_set_interface_lan
"eth0.1"
71 ucidef_add_switch
"switch0" "1" "1"
72 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 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 6t"
79 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
87 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
88 ucidef_add_switch
"switch0" "1" "1"
89 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
90 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
97 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
98 ucidef_add_switch
"switch0" "1" "1"
99 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
100 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
104 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
109 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
110 ucidef_add_switch
"switch0" "1" "1"
111 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
112 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
117 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
118 ucidef_add_switch
"switch0" "1" "1"
119 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
120 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
124 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
127 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
132 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
135 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
139 ucidef_set_interfaces_lan_wan
"eth0.2" "eth0.1"
145 ucidef_set_interface_lan
"eth0"
149 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
150 if [ -n "${RT3X5X}" ]; then
151 ramips_setup_rt3x5x_vlans
153 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
169 lan_mac
=$
(mtd_get_mac_binary factory
40)
193 lan_mac
=$
(mtd_get_mac_binary factory
4)
194 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
198 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
202 lan_mac
=$
(mtd_get_mac_binary factory
4)
203 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
210 lan_mac
=$
(mtd_get_mac_binary factory
40)
211 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
218 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
219 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
223 lan_mac
=$
(mtd_get_mac_binary factory
4)
224 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
225 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
)
236 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
237 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
244 lan_mac
=$
(mtd_get_mac_binary factory
4)
245 lan_mac
=$
(macaddr_add
"$lan_mac" -1)
250 lan_mac
=$
(mtd_get_mac_binary factory
4)
251 wan_mac
=$
(mtd_get_mac_binary factory
40)
255 lan_mac
=$
(mtd_get_mac_binary factory
40)
259 lan_mac
=$
(mtd_get_mac_binary
"u-boot" 262148)
260 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
264 lan_mac
=$
(mtd_get_mac_binary factory
4)
265 wan_mac
=$
(mtd_get_mac_binary factory
32772)
269 lan_mac
=$
(mtd_get_mac_binary factory
40)
270 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
274 lan_mac
=$
(mtd_get_mac_binary factory
40)
275 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
283 lan_mac
=$
(mtd_get_mac_binary factory
40)
284 wan_mac
=$
(mtd_get_mac_binary factory
46)
288 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
289 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
294 lan_mac
=$
(mtd_get_mac_binary factory
4)
299 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
300 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
303 [ -e /etc
/config
/network
] && exit 0
305 touch /etc
/config
/network
307 board
=$
(ramips_board_name
)
309 ramips_setup_interfaces
$board
310 ramips_setup_macs
$board