1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 07:00:37 +02:00

ramips: Add switch setup to uci network defaults

Add switch setup to uci network defaults.

The 'lan' attribute is used to decide into which vlan to put the
port.
Currently 'disable' is never set, but the intention is to use this
for devices like the 8devices Carambola, which only has two ports
hooked up to the SoC.

Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33300 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2012-08-29 10:37:38 +00:00
parent 746f915308
commit 90dab951da

View File

@ -9,6 +9,31 @@ if [ ! -x /usr/sbin/maccalc ]; then
return return
fi fi
ramips_setup_rt3x5x_vlans()
{
if [ ! -x /sbin/swconfig ]; then
# legacy default
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
return
fi
local wanports=""
local lanports=""
for port in 5 4 3 2 1 0; do
if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
continue
fi
if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
wanports="$port $wanports"
else
lanports="$port $lanports"
fi
done
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "rt305x" "1" "1"
ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
}
ramips_setup_interfaces() ramips_setup_interfaces()
{ {
local board="$1" local board="$1"
@ -74,7 +99,7 @@ ramips_setup_interfaces()
*) *)
RT3X5X=`cat /proc/cpuinfo | grep RT3.5` RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
if [ -n "${RT3X5X}" ]; then if [ -n "${RT3X5X}" ]; then
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ramips_setup_rt3x5x_vlans
else else
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
fi fi