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
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_interface_lan
"eth0.1"
68 ucidef_add_switch
"switch0" "1" "1"
69 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
73 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
74 ucidef_add_switch
"switch0" "1" "1"
75 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
76 ucidef_add_switch_vlan
"switch0" "2" "0 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" "0 1 2 3 6t"
84 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)
182 lan_mac
=$
(mtd_get_mac_binary factory
4)
183 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
187 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
191 lan_mac
=$
(mtd_get_mac_binary factory
4)
192 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
198 lan_mac
=$
(mtd_get_mac_binary factory
40)
199 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
205 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
206 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
210 lan_mac
=$
(mtd_get_mac_binary factory
4)
211 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
212 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
216 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
217 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
223 lan_mac
=$
(mtd_get_mac_binary devdata
16388)
224 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
229 lan_mac
=$
(mtd_get_mac_binary factory
4)
230 wan_mac
=$
(mtd_get_mac_binary factory
40)
234 lan_mac
=$
(mtd_get_mac_binary factory
40)
238 lan_mac
=$
(mtd_get_mac_binary
"u-boot" 262148)
239 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
243 lan_mac
=$
(mtd_get_mac_binary factory
4)
244 wan_mac
=$
(mtd_get_mac_binary factory
32772)
248 lan_mac
=$
(mtd_get_mac_binary factory
40)
249 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
253 lan_mac
=$
(mtd_get_mac_binary factory
40)
254 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
262 lan_mac
=$
(mtd_get_mac_binary factory
40)
263 wan_mac
=$
(mtd_get_mac_binary factory
46)
267 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
268 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
273 lan_mac
=$
(mtd_get_mac_binary factory
4)
278 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
279 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
282 [ -e /etc
/config
/network
] && exit 0
284 touch /etc
/config
/network
286 board
=$
(ramips_board_name
)
288 ramips_setup_interfaces
$board
289 ramips_setup_macs
$board