diff mbox

[OpenWrt-Devel,mvebu] WRT1900AC set default switch config

Message ID 1421112630-18804-1-git-send-email-mark.a.milburn@gmail.com
State Not Applicable
Headers show

Commit Message

Mark Milburn Jan. 13, 2015, 1:30 a.m. UTC
Set the default configuration for the switch so that is consistent with how it
was configured by u-Boot.  These changes are essentially identical to:
https://dev.openwrt.org/browser/trunk/target/linux/kirkwood/base-files/etc/uci-defaults/02_network?rev=43750

Signed-off-by: Mark Milburn <mark.a.milburn@gmail.com>
---
 .../linux/mvebu/base-files/etc/uci-defaults/02_network   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox

Patch

diff --git a/target/linux/mvebu/base-files/etc/uci-defaults/02_network b/target/linux/mvebu/base-files/etc/uci-defaults/02_network
index 8b1ed6a..a17b239 100644
--- a/target/linux/mvebu/base-files/etc/uci-defaults/02_network
+++ b/target/linux/mvebu/base-files/etc/uci-defaults/02_network
@@ -7,6 +7,19 @@ 
 
 touch /etc/config/network
 
+add_port_based_vlan() {
+        local device=$1
+	local vlan=$2
+	local ports=$3
+	uci batch <<EOF
+add network switch_vlan
+set network.@switch_vlan[-1].device='$device'
+set network.@switch_vlan[-1].vlan='$vlan'
+set network.@switch_vlan[-1].ports='$ports'
+set network.@switch_vlan[-1].port_based='1'
+EOF
+}
+
 . /lib/functions/uci-defaults.sh
 . /lib/mvebu.sh
 
@@ -17,6 +30,9 @@  board=$(mvebu_board_name)
 case "$board" in
 armada-xp-mamba)
 	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+	ucidef_add_switch "switch0" "1" "0"
+	add_port_based_vlan "switch0" "1" "0 1 2 3 5"
+	add_port_based_vlan "switch0" "2" "4 6"
 	;;
 
 *)