net: new IPsec tests with SCTP protocol

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
diff --git a/runtest/net_stress.ipsec_sctp b/runtest/net_stress.ipsec_sctp
new file mode 100644
index 0000000..b72fb7e
--- /dev/null
+++ b/runtest/net_stress.ipsec_sctp
@@ -0,0 +1,109 @@
+sctp4_ipsec01 sctp_ipsec.sh -s "100 1000 65535"
+sctp4_ipsec02 sctp_ipsec.sh -p ah -m transport -s "100 1000 65535"
+sctp4_ipsec03 sctp_ipsec.sh -p ah -m tunnel -s "100 1000 65535"
+sctp4_ipsec04 sctp_ipsec.sh -p esp -m transport -s "100 1000 65535"
+sctp4_ipsec05 sctp_ipsec.sh -p esp -m tunnel -s "100 1000 65535"
+sctp4_ipsec06 sctp_ipsec.sh -p comp -m transport -s "100 1000 65535"
+sctp4_ipsec07 sctp_ipsec.sh -p comp -m tunnel -s "100 1000 65535"
+sctp4_ipsec08 sctp_ipsec.sh -A rfc4106_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec09 sctp_ipsec.sh -A rfc4106_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec10 sctp_ipsec.sh -A rfc4106_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec11 sctp_ipsec.sh -A rfc4106_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec12 sctp_ipsec.sh -A rfc4106_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec13 sctp_ipsec.sh -A rfc4106_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec14 sctp_ipsec.sh -A rfc4309_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec15 sctp_ipsec.sh -A rfc4309_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec16 sctp_ipsec.sh -A rfc4309_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec17 sctp_ipsec.sh -A rfc4309_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec18 sctp_ipsec.sh -A rfc4309_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec19 sctp_ipsec.sh -A rfc4309_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec20 sctp_ipsec.sh -A rfc4543_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec21 sctp_ipsec.sh -A rfc4543_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec22 sctp_ipsec.sh -A rfc4543_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec23 sctp_ipsec.sh -A rfc4543_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec24 sctp_ipsec.sh -A rfc4543_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp4_ipsec25 sctp_ipsec.sh -A rfc4543_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec26 sctp_ipsec.sh -p esp -a sha1 -e cast5 -m transport -s "100 1000 65535"
+sctp4_ipsec27 sctp_ipsec.sh -p esp -a sha1 -e cast5 -m tunnel -s "100 1000 65535"
+sctp4_ipsec28 sctp_ipsec.sh -p esp -a sha256 -e blowfish -m transport -s "100 1000 65535"
+sctp4_ipsec29 sctp_ipsec.sh -p esp -a sha256 -e blowfish -m tunnel -s "100 1000 65535"
+sctp4_ipsec30 sctp_ipsec.sh -p esp -a sha384 -e twofish -m transport -s "100 1000 65535"
+sctp4_ipsec31 sctp_ipsec.sh -p esp -a sha384 -e twofish -m tunnel -s "100 1000 65535"
+sctp4_ipsec32 sctp_ipsec.sh -p esp -a sha512 -e camellia -m transport -s "100 1000 65535"
+sctp4_ipsec33 sctp_ipsec.sh -p esp -a sha512 -e camellia -m tunnel -s "100 1000 65535"
+sctp4_ipsec34 sctp_ipsec.sh -p esp -a rmd160 -e serpent -m transport -s "100 1000 65535"
+sctp4_ipsec35 sctp_ipsec.sh -p esp -a rmd160 -e serpent -m tunnel -s "100 1000 65535"
+sctp4_ipsec36 sctp_ipsec.sh -p esp -m beet -s "100 1000 65535"
+
+sctp6_ipsec01 sctp_ipsec.sh -6 -s "100 1000 65535"
+sctp6_ipsec02 sctp_ipsec.sh -6 -p ah -m transport -s "100 1000 65535"
+sctp6_ipsec03 sctp_ipsec.sh -6 -p ah -m tunnel -s "100 1000 65535"
+sctp6_ipsec04 sctp_ipsec.sh -6 -p esp -m transport -s "100 1000 65535"
+sctp6_ipsec05 sctp_ipsec.sh -6 -p esp -m tunnel -s "100 1000 65535"
+sctp6_ipsec06 sctp_ipsec.sh -6 -p comp -m transport -s "100 1000 65535"
+sctp6_ipsec07 sctp_ipsec.sh -6 -p comp -m tunnel -s "100 1000 65535"
+sctp6_ipsec08 sctp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec09 sctp_ipsec.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec10 sctp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec11 sctp_ipsec.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec12 sctp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec13 sctp_ipsec.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec14 sctp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec15 sctp_ipsec.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec16 sctp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec17 sctp_ipsec.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec18 sctp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec19 sctp_ipsec.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec20 sctp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec21 sctp_ipsec.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec22 sctp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec23 sctp_ipsec.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec24 sctp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m transport -s "100 1000 65535"
+sctp6_ipsec25 sctp_ipsec.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec26 sctp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m transport -s "100 1000 65535"
+sctp6_ipsec27 sctp_ipsec.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s "100 1000 65535"
+sctp6_ipsec28 sctp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m transport -s "100 1000 65535"
+sctp6_ipsec29 sctp_ipsec.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s "100 1000 65535"
+sctp6_ipsec30 sctp_ipsec.sh -6 -p esp -a sha384 -e twofish -m transport -s "100 1000 65535"
+sctp6_ipsec31 sctp_ipsec.sh -6 -p esp -a sha384 -e twofish -m tunnel -s "100 1000 65535"
+sctp6_ipsec32 sctp_ipsec.sh -6 -p esp -a sha512 -e camellia -m transport -s "100 1000 65535"
+sctp6_ipsec33 sctp_ipsec.sh -6 -p esp -a sha512 -e camellia -m tunnel -s "100 1000 65535"
+sctp6_ipsec34 sctp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m transport -s "100 1000 65535"
+sctp6_ipsec35 sctp_ipsec.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s "100 1000 65535"
+sctp6_ipsec36 sctp_ipsec.sh -6 -p esp -m beet -s "100 1000 65535"
+
+sctp4_ipsec_vti01 sctp_ipsec_vti.sh -p ah -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti02 sctp_ipsec_vti.sh -p esp -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti03 sctp_ipsec_vti.sh -p comp -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti04 sctp_ipsec_vti.sh -A rfc4106_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti05 sctp_ipsec_vti.sh -A rfc4106_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti06 sctp_ipsec_vti.sh -A rfc4106_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti07 sctp_ipsec_vti.sh -A rfc4309_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti08 sctp_ipsec_vti.sh -A rfc4309_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti09 sctp_ipsec_vti.sh -A rfc4309_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti10 sctp_ipsec_vti.sh -A rfc4543_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti11 sctp_ipsec_vti.sh -A rfc4543_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti12 sctp_ipsec_vti.sh -A rfc4543_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti13 sctp_ipsec_vti.sh -p esp -a sha1 -e cast5 -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti14 sctp_ipsec_vti.sh -p esp -a sha256 -e blowfish -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti15 sctp_ipsec_vti.sh -p esp -a sha384 -e twofish -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti16 sctp_ipsec_vti.sh -p esp -a sha512 -e camellia -m tunnel -s "100 1000 65535"
+sctp4_ipsec_vti17 sctp_ipsec_vti.sh -p esp -a rmd160 -e serpent -m tunnel -s "100 1000 65535"
+
+sctp6_ipsec_vti01 sctp_ipsec_vti.sh -6 -p ah -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti02 sctp_ipsec_vti.sh -6 -p esp -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti03 sctp_ipsec_vti.sh -6 -p comp -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti04 sctp_ipsec_vti.sh -6 -A rfc4106_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti05 sctp_ipsec_vti.sh -6 -A rfc4106_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti06 sctp_ipsec_vti.sh -6 -A rfc4106_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti07 sctp_ipsec_vti.sh -6 -A rfc4309_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti08 sctp_ipsec_vti.sh -6 -A rfc4309_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti09 sctp_ipsec_vti.sh -6 -A rfc4309_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti10 sctp_ipsec_vti.sh -6 -A rfc4543_128 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti11 sctp_ipsec_vti.sh -6 -A rfc4543_192 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti12 sctp_ipsec_vti.sh -6 -A rfc4543_256 -p esp_aead -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti13 sctp_ipsec_vti.sh -6 -p esp -a sha1 -e cast5 -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti14 sctp_ipsec_vti.sh -6 -p esp -a sha256 -e blowfish -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti15 sctp_ipsec_vti.sh -6 -p esp -a sha384 -e twofish -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti16 sctp_ipsec_vti.sh -6 -p esp -a sha512 -e camellia -m tunnel -s "100 1000 65535"
+sctp6_ipsec_vti17 sctp_ipsec_vti.sh -6 -p esp -a rmd160 -e serpent -m tunnel -s "100 1000 65535"
diff --git a/testcases/network/stress/sctp/Makefile b/testcases/network/stress/sctp/Makefile
new file mode 100644
index 0000000..2be2b43
--- /dev/null
+++ b/testcases/network/stress/sctp/Makefile
@@ -0,0 +1,23 @@
+# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= sctp_ipsec.sh \
+			   sctp_ipsec_vti.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/sctp/sctp_ipsec.sh b/testcases/network/stress/sctp/sctp_ipsec.sh
new file mode 100755
index 0000000..bd4f349
--- /dev/null
+++ b/testcases/network/stress/sctp/sctp_ipsec.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
+
+TCID=sctp_ipsec
+TST_TOTAL=3
+TST_CLEANUP="tst_ipsec_cleanup"
+
+. ipsec_lib.sh
+
+do_setup()
+{
+	# Configure SAD/SPD
+	if [ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ]; then
+		tst_ipsec lhost $(tst_ipaddr) $(tst_ipaddr rhost)
+		tst_ipsec rhost $(tst_ipaddr rhost) $(tst_ipaddr)
+	fi
+}
+
+do_test()
+{
+	for p in $IPSEC_SIZE_ARRAY; do
+		tst_netload -H $(tst_ipaddr rhost) -T sctp -n $p -N $p \
+			-r $IPSEC_REQUESTS
+	done
+}
+
+do_setup
+
+do_test
+
+tst_exit
diff --git a/testcases/network/stress/sctp/sctp_ipsec_vti.sh b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
new file mode 100755
index 0000000..6ac6e21
--- /dev/null
+++ b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
+
+TCID=sctp_ipsec_vti
+TST_TOTAL=3
+TST_CLEANUP="tst_ipsec_cleanup"
+
+. ipsec_lib.sh
+
+do_test()
+{
+	for p in $IPSEC_SIZE_ARRAY; do
+		tst_netload -H $ip_rmt_tun -T sctp -n $p -N $p \
+			-r $IPSEC_REQUESTS
+	done
+}
+
+tst_ipsec_setup_vti
+
+do_test
+
+tst_exit
diff --git a/testscripts/network.sh b/testscripts/network.sh
index c6afdab..eb991b6 100755
--- a/testscripts/network.sh
+++ b/testscripts/network.sh
@@ -36,6 +36,7 @@
 	echo "  -T    IPsec TCP stress tests"
 	echo "  -U    IPsec UDP stress tests"
 	echo "  -D    IPsec DCCP stress tests"
+	echo "  -S    IPsec SCTP stress tests"
 	echo "  -R    route stress tests"
 	echo "  -M    multicast stress tests"
 	echo "  -F    network features tests (TFO, vxlan, etc.)"
@@ -47,7 +48,7 @@
 	echo "  -h    print this help"
 }
 
-while getopts 6mnrstaebcdiTUDRMFf:qQVvh OPTION
+while getopts 6mnrstaebcdiTUDSRMFf:qQVvh OPTION
 do
 	case $OPTION in
 	6) TEST_CASES="$TEST_CASES net.ipv6 net.ipv6_lib";;
@@ -65,6 +66,7 @@
 	T) TEST_CASES="$TEST_CASES net_stress.ipsec_tcp";;
 	U) TEST_CASES="$TEST_CASES net_stress.ipsec_udp";;
 	D) TEST_CASES="$TEST_CASES net_stress.ipsec_dccp";;
+	S) TEST_CASES="$TEST_CASES net_stress.ipsec_sctp";;
 	R) TEST_CASES="$TEST_CASES net_stress.route";;
 	M) TEST_CASES="$TEST_CASES net_stress.multicast";;
 	F) TEST_CASES="$TEST_CASES net.features";;