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"
65 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
69 ucidef_set_interface_lan
"eth0.1"
70 ucidef_add_switch
"switch0" "1" "1"
71 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
80 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
81 ucidef_add_switch
"switch0" "1" "1"
82 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 6t"
83 ucidef_add_switch_vlan
"switch0" "2" "4 6t"
93 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
94 ucidef_add_switch
"switch0" "1" "1"
95 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 6t"
96 ucidef_add_switch_vlan
"switch0" "2" "0 6t"
100 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
105 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
106 ucidef_add_switch
"switch0" "1" "1"
107 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
108 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
113 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
114 ucidef_add_switch
"switch0" "1" "1"
115 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
116 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
120 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
121 ucidef_add_switch
"switch0" "1" "1"
122 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
123 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
128 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
129 ucidef_add_switch
"switch0" "1" "1"
130 ucidef_add_switch_vlan
"switch0" "1" "0t 1 2 3 4"
131 ucidef_add_switch_vlan
"switch0" "2" "0t 5"
135 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
136 ucidef_add_switch
"switch0" "1" "1"
137 ucidef_add_switch_vlan
"switch0" "1" "0 6t"
138 ucidef_add_switch_vlan
"switch0" "2" "6t"
144 ucidef_set_interface_lan
"eth0"
148 RT3X5X
=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
149 if [ -n "${RT3X5X}" ]; then
150 ramips_setup_rt3x5x_vlans
152 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
166 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
170 wan_mac
=$
(macaddr_add
"$lan_mac" 5)
174 wan_mac
=$
(macaddr_add
"$lan_mac" 3)
178 wan_mac
=$
(macaddr_add
"$lan_mac" 4)
185 lan_mac
=$
(macaddr_add
"$lan_mac" -1)
189 lan_mac
=$
(macaddr_setbit_la
"$lan_mac")
190 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
194 lan_mac
=$
(mtd_get_mac_ascii nvram lanmac
)
195 wan_mac
=$
(mtd_get_mac_ascii nvram wanmac
)
200 wan_mac
=$
(mtd_get_mac_binary factory
40)
204 wan_mac
=$
(mtd_get_mac_binary factory
32772)
212 wan_mac
=$
(mtd_get_mac_binary factory
46)
216 lan_mac
=$
(mtd_get_mac_binary board-nvram
65440)
217 wan_mac
=$
(macaddr_add
"$lan_mac" 1)
222 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
223 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
226 [ -e /etc
/config
/network
] && exit 0
228 touch /etc
/config
/network
230 board
=$
(ramips_board_name
)
232 ramips_setup_interfaces
$board
233 ramips_setup_macs
$board