5 .
/lib
/functions
/uci-defaults.sh
6 .
/lib
/functions
/system.sh
8 ramips_setup_rt3x5x_vlans
()
10 if [ ! -x /sbin
/swconfig
]; then
12 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
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
49 ucidef_add_switch
"switch0" "1" "0"
50 ucidef_set_interface_lan
"eth0"
56 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" "0 6t"
73 ucidef_add_switch_vlan
"switch0" "2" "1 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" "1 2 3 4 9t"
80 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
84 ucidef_set_interface_lan
"eth0.1"
85 ucidef_add_switch
"switch0" "1" "1"
86 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
90 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
91 ucidef_add_switch
"switch0" "1" "1"
92 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
93 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
103 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
104 ucidef_add_switch
"switch0" "1" "1"
105 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
106 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
120 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
121 ucidef_add_switch
"switch0" "1" "1"
122 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
123 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
127 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
132 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
133 ucidef_add_switch
"switch0" "1" "1"
134 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
135 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
141 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
142 ucidef_add_switch
"switch0" "1" "1"
143 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
144 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
148 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
149 ucidef_add_switch
"switch0" "1" "1"
150 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
151 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
156 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
157 ucidef_add_switch
"switch0" "1" "1"
158 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
159 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
163 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
164 ucidef_add_switch
"switch0" "1" "1"
165 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
166 ucidef_add_switch_vlan
"switch0" "2" "6t"
170 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
171 ucidef_add_switch
"switch0" "1" "1"
172 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
173 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
180 ucidef_set_interface_lan
"eth0"
184 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
185 if [ -n "${RT3X5X}" ]; then
186 ramips_setup_rt3x5x_vlans
188 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
202 lan_mac
=$
(mtd_get_mac_binary devdata
13)
203 wan_mac
=$
(mtd_get_mac_binary devdata
7)
207 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
211 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
215 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
222 lan_mac
=$
(macaddr_add
"$lan_mac" -1)
226 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
227 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
232 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
233 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
238 wan_mac
=$
(mtd_get_mac_binary factory
40)
242 wan_mac
=$
(mtd_get_mac_binary factory
32772)
250 wan_mac
=$
(mtd_get_mac_binary factory
46)
254 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
255 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
259 lan_mac
=$
(mtd_get_mac_binary factory
4)
260 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
264 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
265 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
270 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
271 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
274 [ -e /etc
/config
/network
] && exit 0
276 touch /etc
/config
/network
278 board
=$
(ramips_board_name
)
280 ramips_setup_interfaces
$board
281 ramips_setup_macs
$board