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"
55 ucidef_set_interface_lan
"eth0.2"
60 ucidef_set_interface_lan
"eth0.1"
70 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
74 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
75 ucidef_add_switch
"switch0" "1" "1"
76 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
77 ucidef_add_switch_vlan
"switch0" "2" "1 6t"
81 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
82 ucidef_add_switch
"switch0" "1" "1"
83 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 9t"
84 ucidef_add_switch_vlan
"switch0" "2" "0 9t"
88 ucidef_set_interface_lan
"eth0.1"
89 ucidef_add_switch
"switch0" "1" "1"
90 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
94 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
95 ucidef_add_switch
"switch0" "1" "1"
96 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 9t"
97 ucidef_add_switch_vlan
"switch0" "2" "4 9t"
107 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
108 ucidef_add_switch
"switch0" "1" "1"
109 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
110 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
124 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
125 ucidef_add_switch
"switch0" "1" "1"
126 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
127 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
131 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
136 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
137 ucidef_add_switch
"switch0" "1" "1"
138 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
139 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
145 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
146 ucidef_add_switch
"switch0" "1" "1"
147 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
148 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
152 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
153 ucidef_add_switch
"switch0" "1" "1"
154 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
155 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
160 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
161 ucidef_add_switch
"switch0" "1" "1"
162 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
163 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
167 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
168 ucidef_add_switch
"switch0" "1" "1"
169 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
170 ucidef_add_switch_vlan
"switch0" "2" "6t"
174 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
175 ucidef_add_switch
"switch0" "1" "1"
176 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 4 6t"
177 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
184 ucidef_set_interface_lan
"eth0"
188 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
189 if [ -n "${RT3X5X}" ]; then
190 ramips_setup_rt3x5x_vlans
192 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
206 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
207 wan_mac
=$
(mtd_get_mac_binary devdata
7)
211 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
212 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
216 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
217 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
221 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
222 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
229 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
230 lan_mac
=$
(macaddr_add
"$lan_mac" -2)
246 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
247 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
248 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
253 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
254 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
258 wan_mac
=$
(mtd_get_mac_binary factory
40)
262 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
263 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
264 wan_mac
=$
(mtd_get_mac_binary factory
32772)
272 wan_mac
=$
(mtd_get_mac_binary factory
46)
276 lan_mac
=$
(cat /sys
/class
/net
/eth
0/address
)
277 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
282 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
283 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
286 [ -e /etc
/config
/network
] && exit 0
288 touch /etc
/config
/network
290 board
=$
(ramips_board_name
)
292 ramips_setup_interfaces
$board
293 ramips_setup_macs
$board