Skip to contentSkip to conversation

networking/stress/icmp: add ip xfrm ipsec support

PATCH Superseded Hangbin Liu 2 participants 6 messages Apr 27, 2016 – Apr 29, 2016

lore
Share & tools
lore
#0 lore raw

v8 cover networking/stress/icmp: add ip xfrm ipsec support

As we know, most of the network stress tests have IPsec testing, and we use setkey for configuration. But setkey[1] hasn't updated for a long time. And some distros, RHEL7 for example, even don't have ipset-tools package. On other hand, iproute2 is recommend for network configuration. And ip xfrm is more powerful than setkey. So let's use ip xfrm for ipsec testing.

[1] http://ipsec-tools.sourceforge.net/

Change from V7:
1. correct array typo
2. use shift instead of bashism

Hangbin Liu (3):
lib/test_net.sh: add tst_ping() to check icmp connectivity network/stress: add ipsec lib
network/stress/icmp: add icmp-uni-basic to implement all icmp basic
stress test

 runtest/network_stress.icmp                  |  46 +++++++----
 testcases/lib/test_net.sh                    |  30 ++++++++
 testcases/network/stress/icmp/Makefile       |   3 +
 testcases/network/stress/icmp/icmp-uni-basic |  90 ++++++++++++++++++++++
 testcases/network/stress/ipsec/Makefile      |  28 +++++++
 testcases/network/stress/ipsec/ipsec_lib.sh  | 110 +++++++++++++++++++++++++++
 6 files changed, 293 insertions(+), 14 deletions(-)
 create mode 100755 testcases/network/stress/icmp/icmp-uni-basic
 create mode 100644 testcases/network/stress/ipsec/Makefile
 create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh
Signature · 1 line
2.5.5
#1 lore raw

PATCH v8 1/3 lib/test_net.sh: add tst_ping() to check icmp connectivity

---
 testcases/lib/test_net.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
testcases/lib/test_net.sh +30 -0
index 418fed3..f391302 100644
@@ -314,3 +314,33 @@ tst_netload()
 
 	return $ret
 }
+
+# tst_ping [IFACE] [DST ADDR] [MESSAGE SIZE ARRAY]
+# Check icmp connectivity
+# IFACE: source interface name
+# DST ADDR: destination IPv4 or IPv6 address
+# MESSAGE SIZE ARRAY: message size array
+tst_ping()
+{
+	# The max number of ICMP echo request
+	PING_MAX=${PING_MAX:-"10"}
+
+	local src_iface=${1:-"$(tst_iface)"}
+	local dst_addr=${2:-"$(tst_ipaddr rhost)"}; shift 2
+	local msg_sizes=$@
+	local ret=0
+
+	# ping cmd use 56 as default message size
+	for size in ${msg_sizes:-"56"}; do
+		ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
+			-s $size > /dev/null 2>&1
+		ret=$?
+		if [ $ret -eq 0 ]; then
+			tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size pass"
+		else
+			tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size fail"
+			break
+		fi
+	done
+	return $ret
+}
Signature · 1 line
2.5.5
#2 lore raw

PATCH v8 2/3 network/stress: add ipsec lib

In reply to Hangbin Liu
---
 testcases/network/stress/ipsec/Makefile     |  28 +++++++
 testcases/network/stress/ipsec/ipsec_lib.sh | 110 ++++++++++++++++++++++++++++
 2 files changed, 138 insertions(+)
 create mode 100644 testcases/network/stress/ipsec/Makefile
 create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh
testcases/network/stress/ipsec/Makefile new file +28 -0
new file mode 100644
index 0000000..43352cc
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (c) 2016 Red Hat Inc.,  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: Hangbin Liu <[email protected]>
+#
+#######################################################################
+
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= *.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/stress/ipsec/ipsec_lib.sh new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.5.5
#3 lore raw

PATCH v8 3/3 network/stress/icmp: add icmp-uni-basic to implement all icmp basic stress test

In reply to Hangbin Liu

Add icmp-uni-basic to implement the test case and define each test case in "runtest/" and use parameters. Also use ip xfrm instead of setkey for ipsec testing.

---
 runtest/network_stress.icmp                  | 46 +++++++++-----
 testcases/network/stress/icmp/Makefile       |  3 +
 testcases/network/stress/icmp/icmp-uni-basic | 90 ++++++++++++++++++++++++++++
 3 files changed, 125 insertions(+), 14 deletions(-)
 create mode 100755 testcases/network/stress/icmp/icmp-uni-basic
runtest/network_stress.icmp +32 -14
index 29b52d1..ba30200 100644
@@ -2,21 +2,39 @@
 # Stress test for TCP/IP protocol stack (ICMP)
 #
 
-icmp4-uni-basic01 icmp4-uni-basic01
-icmp4-uni-basic02 icmp4-uni-basic02
-icmp4-uni-basic03 icmp4-uni-basic03
-icmp4-uni-basic04 icmp4-uni-basic04
-icmp4-uni-basic05 icmp4-uni-basic05
-icmp4-uni-basic06 icmp4-uni-basic06
-icmp4-uni-basic07 icmp4-uni-basic07
+# MAX_LENGTH(65535) - IP(20) - ICMP(8) = MAX_SIZE(65507)
+icmp4-uni-basic01 icmp-uni-basic -s "10 100 1000 10000 65507"
+# MAX_LENGTH(65535) - IP(20) - AH(24) - ICMP(8) = MAX_SIZE(65483)
+icmp4-uni-basic02 icmp-uni-basic -p ah -m transport -s "10 100 1000 10000 65483"
+# MAX_LENGTH(65535) - IP(20) - AH(24) - Tunnel(IPv4 20) - ICMP(8) = MAX_SIZE(65463)
+icmp4-uni-basic03 icmp-uni-basic -p ah -m tunnel -s "10 100 1000 10000 65463"
+# MAX_LENGTH(65535) - IP(20) - ESP (37) - ICMP(8) = MAX_SIZE(65470)
+# ESP Header has pad payload, so the ESP length is variable
+icmp4-uni-basic04 icmp-uni-basic -p esp -m transport -s "10 100 1000 10000 65470"
+# MAX_LENGTH(65535) - IP(20) - ESP (37) - Tunnel(20) - ICMP(8) = MAX_SIZE(65450)
+icmp4-uni-basic05 icmp-uni-basic -p esp -m tunnel -s "10 100 1000 10000 65450"
+# Same message size but different content will result in different data size
+# after compression. So we just use a large enough message size(65000) for testing
+icmp4-uni-basic06 icmp-uni-basic -p ipcomp -m transport -s "10 100 1000 10000 65000"
+icmp4-uni-basic07 icmp-uni-basic -p ipcomp -m tunnel -s "10 100 1000 10000 65000"
 
-icmp6-uni-basic01 icmp6-uni-basic01
-icmp6-uni-basic02 icmp6-uni-basic02
-icmp6-uni-basic03 icmp6-uni-basic03
-icmp6-uni-basic04 icmp6-uni-basic04
-icmp6-uni-basic05 icmp6-uni-basic05
-icmp6-uni-basic06 icmp6-uni-basic06
-icmp6-uni-basic07 icmp6-uni-basic07
+# MAX_LENGTH(65535) - ICMP(8) = MAX_SIZE(65527)
+icmp6-uni-basic01 icmp-uni-basic -6 -s "10 100 1000 10000 65527"
+# MAX_LENGTH(65535) - AH(24) - ICMP(8) = MAX_SIZE(65503)
+icmp6-uni-basic02 icmp-uni-basic -6 -p ah -m transport -s "10 100 1000 10000 65503"
+# MAX_LENGTH(65535) - ICMP(8) = MAX_SIZE(65527)
+# When receive, we drop the tunnel header first and only leave the inside IPv6
+# Header and icmp message. That's why we can have so large message size.
+icmp6-uni-basic03 icmp-uni-basic -6 -p ah -m tunnel -s "10 100 1000 10000 65527"
+# MAX_LENGTH(65535) - ESP (33) - ICMP(8) = MAX_SIZE(65494)
+# ESP Header has pad payload, so the ESP length is variable
+icmp6-uni-basic04 icmp-uni-basic -6 -p esp -m transport -s "10 100 1000 10000 65494"
+# MAX_LENGTH(65535) - ICMP(8) = MAX_SIZE(65527)
+icmp6-uni-basic05 icmp-uni-basic -6 -p esp -m tunnel -s "10 100 1000 10000 65527"
+# Same message size but different content will result in different data size
+# after compression. So we just use a large enough message size(65000) for testing
+icmp6-uni-basic06 icmp-uni-basic -6 -p ipcomp -m transport -s "10 100 1000 10000 65000"
+icmp6-uni-basic07 icmp-uni-basic -6 -p ipcomp -m tunnel -s "10 100 1000 10000 65000"
 
 icmp4-multi-diffip01 icmp4-multi-diffip01
 icmp4-multi-diffip02 icmp4-multi-diffip02
testcases/network/stress/icmp/Makefile +3 -0
index 0dad1d1..9310aa1 100644
@@ -23,4 +23,7 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= icmp*
+
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/network/stress/icmp/icmp-uni-basic new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.5.5
#4 lore raw

v8 cover networking/stress/icmp: add ip xfrm ipsec support

In reply to Hangbin Liu

Hi,

Quoted 11 lines · Hangbin Liu

As we know, most of the network stress tests have IPsec testing, and we use setkey for configuration. But setkey[1] hasn't updated for a long time. And some distros, RHEL7 for example, even don't have ipset-tools package. On other hand, iproute2 is recommend for network configuration. And ip xfrm is more powerful than setkey. So let's use ip xfrm for ipsec testing.

[1] http://ipsec-tools.sourceforge.net/

Change from V7:
1. correct array typo
2. use shift instead of bashism

Patch-set applied, thank you.

Also made some cosmetic changes:

* reworded that really lengthy message with "Verify that kernel ...." in icmp-basic-uni,
* added suffix ".sh" to icmp-uni-basic,
* some lines were over 80 chars, changed them too where possible,
* added copyright line from the previous version of uni-basic tests,
* removed old uni-basic directory.

Thanks,
Alexey

#5 lore raw

v8 cover networking/stress/icmp: add ip xfrm ipsec support

Hi Alexey,

Thanks for your patient reviews and cosmetic changes.

Best Regards
Hangbin

Quoted 26 lines · Alexey Kodanev

Hi,

Quoted 11 lines · Hangbin Liu

As we know, most of the network stress tests have IPsec testing, and we use setkey for configuration. But setkey[1] hasn't updated for a long time. And some distros, RHEL7 for example, even don't have ipset-tools package. On other hand, iproute2 is recommend for network configuration. And ip xfrm is more powerful than setkey. So let's use ip xfrm for ipsec testing.

[1] http://ipsec-tools.sourceforge.net/

Change from V7:
1. correct array typo
2. use shift instead of bashism

Patch-set applied, thank you.

Also made some cosmetic changes:

* reworded that really lengthy message with "Verify that kernel ...." in icmp-basic-uni,
* added suffix ".sh" to icmp-uni-basic,
* some lines were over 80 chars, changed them too where possible,
* added copyright line from the previous version of uni-basic tests,
* removed old uni-basic directory.

Thanks,
Alexey