summaryrefslogtreecommitdiff
path: root/target/linux/ramips
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-08-29 10:37:38 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-08-29 10:37:38 +0000
commit1f3400d3b4cd3cf817cf63585d3843d1dd1e76d0 (patch)
treeefd728582c95af5c1314bc5063b78455514f50fc /target/linux/ramips
parent3b17f1deb84ad3f3fa0c98a4cf2cda971fcb3bb3 (diff)
downloadmtk-20170518-1f3400d3b4cd3cf817cf63585d3843d1dd1e76d0.zip
mtk-20170518-1f3400d3b4cd3cf817cf63585d3843d1dd1e76d0.tar.gz
mtk-20170518-1f3400d3b4cd3cf817cf63585d3843d1dd1e76d0.tar.bz2
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> SVN-Revision: 33300
Diffstat (limited to 'target/linux/ramips')
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/network27
1 files changed, 26 insertions, 1 deletions
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network b/target/linux/ramips/base-files/etc/uci-defaults/network
index 106a613..6542d02 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/network
@@ -9,6 +9,31 @@ if [ ! -x /usr/sbin/maccalc ]; then
return
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()
{
local board="$1"
@@ -74,7 +99,7 @@ ramips_setup_interfaces()
*)
RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
if [ -n "${RT3X5X}" ]; then
- ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ramips_setup_rt3x5x_vlans
else
ucidef_set_interfaces_lan_wan "eth0" "eth1"
fi