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

mark milburn mark.a.milburn at gmail.com
Mon Jan 12 20:20:49 EST 2015


Oops.  forgot to --signoff.  resubmitting.

On Mon, Jan 12, 2015 at 6:15 PM, Mark Milburn <mark.a.milburn at gmail.com> wrote:
> 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
> ---
>  .../linux/mvebu/base-files/etc/uci-defaults/02_network   | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> 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. at switch_vlan[-1].device='$device'
> +set network. at switch_vlan[-1].vlan='$vlan'
> +set network. at switch_vlan[-1].ports='$ports'
> +set network. at 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"
>         ;;
>
>  *)
> --
> 2.2.1
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list