All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP]  [PATCHv3 0/3] networking/stress: add ip xfrm ipsec support
@ 2016-03-17 10:04 Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Hangbin Liu @ 2016-03-17 10:04 UTC (permalink / raw)
  To: ltp

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 V2:
1. remove c2x and use hexdump directly.
2. remove indent after "case".
3. remove useless export and old scripts like check_env.
4. remove tst_init_iface.
5. remove return value check after setup ipsec env.
6. remove addr config as Alexey said, we assume the address already added.

Change from V1:
1. update tst_ping() to use default iface and addr. make ping from local side.
2. remove unused variables. add -s option when use tst_rhost_run. Use ROD
   before normal commands.
3. change all "tst_resm TBROK && exit" to "tst_brkm TBROK"
3. still keep tst_init_iface in test icmp4-uni-basic01 because we will
   set_ipv4/6addr each time.

Hangbin Liu (3):
  lib/test_net.sh: add tst_ping() to check icmp connectivity
  network/stress: add ipsec lib
  network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing

 testcases/lib/test_net.sh                          |  19 +++
 .../stress/icmp/uni-basic/icmp4-uni-basic01        | 160 ++++-----------------
 testcases/network/stress/ipsec/Makefile            |  29 ++++
 testcases/network/stress/ipsec/ipsec_lib.sh        | 111 ++++++++++++++
 4 files changed, 183 insertions(+), 136 deletions(-)
 create mode 100644 testcases/network/stress/ipsec/Makefile
 create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh

-- 
2.5.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity
  2016-03-17 10:04 [LTP] [PATCHv3 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
@ 2016-03-17 10:04 ` Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 2/3] network/stress: add ipsec lib Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing Hangbin Liu
  2 siblings, 0 replies; 16+ messages in thread
From: Hangbin Liu @ 2016-03-17 10:04 UTC (permalink / raw)
  To: ltp

Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
 testcases/lib/test_net.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 418fed3..da82ed9 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -314,3 +314,22 @@ tst_netload()
 
 	return $ret
 }
+
+# tst_ping [IFACE] [ADDR] [SIZE]
+# Check icmp connectivity
+# IFACE: source interface name
+# ADDR: destination IPv4 or IPv6 address
+# SIZE: message size
+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)"}
+	# ping cmd use 56 as default message size
+	local msg_size=${3:-"56"}
+
+	ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr -s $msg_size > \
+		/dev/null 2>&1
+}
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP]  [PATCHv3 2/3] network/stress: add ipsec lib
  2016-03-17 10:04 [LTP] [PATCHv3 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
@ 2016-03-17 10:04 ` Hangbin Liu
  2016-03-22 12:51   ` Alexey Kodanev
  2016-03-17 10:04 ` [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing Hangbin Liu
  2 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-03-17 10:04 UTC (permalink / raw)
  To: ltp

Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
 testcases/network/stress/ipsec/Makefile     |  29 ++++++++
 testcases/network/stress/ipsec/ipsec_lib.sh | 111 ++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)
 create mode 100644 testcases/network/stress/ipsec/Makefile
 create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh

diff --git a/testcases/network/stress/ipsec/Makefile b/testcases/network/stress/ipsec/Makefile
new file mode 100644
index 0000000..0d7f1b6
--- /dev/null
+++ b/testcases/network/stress/ipsec/Makefile
@@ -0,0 +1,29 @@
+#!/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, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# Author: Hangbin Liu <haliu@redhat.com>
+#
+#######################################################################
+
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= *.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
new file mode 100644
index 0000000..33716ce
--- /dev/null
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -0,0 +1,111 @@
+#!/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 <haliu@redhat.com>
+#
+#######################################################################
+
+. test_net.sh
+
+# tst_ipsec flush: flush the ipsec state and policy
+# tst_ipsec target protocol mode spi src_addr dst_addr: config ipsec
+#
+# target: target of the configuration file ( src / dst )
+# protocol: ah / esp / ipcomp
+# mode: transport / tunnel
+# spi: the first spi value
+# src_addr: source IP address
+# dst_addr: destination IP address
+tst_ipsec()
+{
+	if [ "$1" = "flush" ]; then
+		ROD ip xfrm state flush
+		ROD ip xfrm policy flush
+		tst_rhost_run -s -c "ip xfrm state flush && ip xfrm policy flush"
+		return 0
+	fi
+	if [ $# -ne 6 ]; then
+		tst_resm TINFO "tst_ipsec parameter mismatch"
+		return 1
+	fi
+
+	target=$1
+	protocol=$2
+	mode=$3
+	spi=$4
+	src=$5
+	dst=$6
+
+	# Encryption algorithm
+	EALGO="des3_ede"
+	EALGO_KEY=0x$(printf _I_want_to_have_chicken_ | hexdump -ve '/1 "%x"')
+
+	# Authentication algorithm
+	AALGO="sha1"
+	AALGO_KEY=0x$(printf beef_fish_pork_salad | hexdump -ve '/1 "%x"')
+
+	# Compression algorithm
+	CALGO="deflate"
+	# Algorithm options for each protocol
+	case $protocol in
+	ah)
+		algo_line="auth $AALGO $AALGO_KEY"
+		proto="ah"
+		;;
+	esp)
+		algo_line="enc $EALGO $EALGO_KEY auth $AALGO $AALGO_KEY"
+		proto="esp"
+		;;
+	ipcomp)
+		algo_line="comp $CALGO"
+		proto="comp"
+		;;
+	*)
+		tst_resm TINFO "tst_ipsec protocol mismatch"
+		return 1
+		;;
+	esac
+
+	if [ $target = src ]; then
+		spi_1="0x$spi"
+		spi_2="0x$(( $spi + 1 ))"
+		ROD ip xfrm state add src $src dst $dst spi $spi_1 proto $proto \
+			$algo_line mode $mode sel src $src dst $dst
+		ROD ip xfrm policy add src $src dst $dst dir out tmpl src $src \
+			dst $dst proto $proto mode $mode
+
+		ROD ip xfrm state add src $dst dst $src spi $spi_2 proto $proto \
+			$algo_line mode $mode sel src $dst dst $src
+		ROD ip xfrm policy add src $dst dst $src dir in tmpl src $dst \
+			dst $src proto $proto mode $mode level use
+		ROD ip xfrm state
+		ROD ip xfrm policy
+	elif [ $target = dst ]; then
+		spi_1="0x$(( $spi + 1 ))"
+		spi_2="0x$spi"
+		tst_rhost_run -s -c "ip xfrm state add src $src dst $dst spi $spi_1 \
+			proto $proto $algo_line mode $mode sel src $src dst $dst"
+		tst_rhost_run -s -c "ip xfrm policy add src $src dst $dst dir out \
+			tmpl src $src dst $dst proto $proto mode $mode"
+
+		tst_rhost_run -s -c "ip xfrm state add src $dst dst $src spi $spi_2 \
+			proto $proto $algo_line mode $mode sel src $dst dst $src"
+		tst_rhost_run -s -c "ip xfrm policy add src $dst dst $src dir in \
+			tmpl src $dst dst $src proto $proto mode $mode level use"
+		tst_rhost_run -s -c "ip xfrm state"
+		tst_rhost_run -s -c "ip xfrm policy"
+	fi
+}
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-17 10:04 [LTP] [PATCHv3 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
  2016-03-17 10:04 ` [LTP] [PATCHv3 2/3] network/stress: add ipsec lib Hangbin Liu
@ 2016-03-17 10:04 ` Hangbin Liu
  2016-03-22 13:34   ` Alexey Kodanev
  2 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-03-17 10:04 UTC (permalink / raw)
  To: ltp

Also check each msg_size in $ICMP_SIZE_ARRAY to make sure the connectvity.

Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
 .../stress/icmp/uni-basic/icmp4-uni-basic01        | 160 ++++-----------------
 1 file changed, 24 insertions(+), 136 deletions(-)

diff --git a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01 b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
index b78ac8f..7c23cc7 100644
--- a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
+++ b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
@@ -42,17 +42,13 @@
 #	Oct 19 2005 - Created (Mitsuru Chinen)
 #
 #-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
 # The test case ID, the test case count and the total number of test case
 TCID=${TCID:-icmp4-uni-basic01}
 TST_TOTAL=1
 TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
+TST_CLEANUP="do_cleanup"
+
+. ipsec_lib.sh
 
 # Test description
 tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending various size of ICMP message with the following conditions"
@@ -61,9 +57,6 @@ tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending
 LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
 export LTPROOT
 
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
 # Dulation of the test [sec]
 NS_DURATION=${NS_DURATION:-3600}      # 1 hour
 
@@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
 
 # The version of IP
 IP_VER=${IP_VER:-4}
+[ $IP_VER -eq 6 ] && TST_IPV6=6
 
 # true, if ipsec is used
 DO_IPSEC=${DO_IPSEC:-false}
@@ -100,16 +94,8 @@ ICMP_SIZE_ARRAY=${ICMP_SIZE_ARRAY:-"10 100 1000 10000 65507"}
 #-----------------------------------------------------------------------
 do_cleanup()
 {
-    # Kill the icmp traffic server
-    killall_icmp_traffic
-
     # Unset SAD/SPD
-    output_ipsec_conf flush | setkey -c >/dev/null 2>&1
-    $LTP_RSH $RHOST ${LTPROOT}/'testcases/bin/output_ipsec_conf flush | PATH=/sbin:/usr/sbin:$PATH setkey -c' >/dev/null 2>&1
-
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
+    tst_ipsec flush
 }
 
 
@@ -127,10 +113,9 @@ tst_resm TINFO "- Version of IP is IPv${IP_VER}"
 tst_resm TINFO "- Size of packets are ( $ICMP_SIZE_ARRAY )"
 
 if $DO_IPSEC ; then
-    message=`check_setkey`
+    message=`ip xfrm state`
     if [ $? -ne 0 ]; then
-	tst_resm TBROK "$message"
-	exit 1
+	tst_brkm TBROK "$message"
     fi
 
     case $IPSEC_PROTO in
@@ -147,16 +132,14 @@ if $DO_IPSEC ; then
 fi
 
 # name of interface of the local/remote host
-lhost_ifname=`get_ifname lhost $LINK_NUM`
+lhost_ifname=`tst_iface lhost $LINK_NUM`
 if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the local host"
-    exit $TST_TOTAL
+    tst_brkm TBROK "Failed to get the interface name at the local host"
 fi
 
-rhost_ifname=`get_ifname rhost $LINK_NUM`
+rhost_ifname=`tst_iface rhost $LINK_NUM`
 if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
+    tst_brkm TBROK "Failed to get the interface name at the remote host"
 fi
 
 # Initialize the system configuration
@@ -165,125 +148,30 @@ do_cleanup
 # Call do_cleanup function before exit
 trap do_cleanup 0
 
-# Configurate IP addresses
-case $IP_VER in
-    4)
-    # Network portion of the IPv4 address
-    network_part=${IPV4_NETWORK:-"10.0.0"}
-
-    # Netmask of the IPv4 network
-    network_mask=24
-
-    # Host portion of the IPv4 address
-    lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-    rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-    # Set IPv4 addresses to the interfaces
-    set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add any IP address at the local host"
-	exit 1
-    fi
-
-    set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add any IP address at the remote host"
-	exit 1
-    fi
-
-    # IPv4 address of the local/remote host
-    lhost_addr="${network_part}.${lhost_host_part}"
-    rhost_addr="${network_part}.${rhost_host_part}"
-    ;;
-
-    6)
-    # Network portion of the IPv6 address
-    network_part="fd00:1:1:1"
-
-    # Netmask of the IPv6 network
-    network_mask=64
-
-    # Host portion of the IPv6 address
-    lhost_host_part=":2"     # local host
-    rhost_host_part=":1"     # remote host
-
-    # Set IPv6 addresses to the interfaces
-    add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add any IP address at the local host"
-	exit 1
-    fi
-
-    add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add any IP address at the remote host"
-	exit 1
-    fi
-
-    # IPv6 address of the local/remote host
-    lhost_addr="${network_part}:${lhost_host_part}"
-    rhost_addr="${network_part}:${rhost_host_part}"
-    ;;
-
-    *)
-    tst_resm TBROK "Unknown IP version"
-    ;;
-esac
+lhost_addr=$(tst_ipaddr)
+rhost_addr=$(tst_ipaddr rhost)
 
 # Configure SAD/SPD
 if $DO_IPSEC ; then
-    ipsec_log=`mktemp -p $TMPDIR`
-
-    output_ipsec_conf src \
-	$IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr \
-	    |  setkey -c 2>&1 | tee $ipsec_log
-    if [ $? -ne 0 -o -s $ipsec_log ]; then
-	tst_resm TBROK "Failed to configure SAD/SPD on the local host."
-	rm -f $ipsec_log
-	exit 1
-    fi
-
-    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/output_ipsec_conf dst $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr' | PATH=/sbin:/usr/sbin:$PATH setkey -c' 2>&1 | tee $ipsec_log
-    if [ $? -ne 0 -o -s $ipsec_log ]; then
-	tst_resm TBROK "Failed to configure SAD/SPD on the remote host."
-	rm -f $ipsec_log
-	exit 1
-    fi
-    rm -f $ipsec_log
+    tst_ipsec src $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr
+    tst_ipsec dst $IPSEC_PROTO $IPSEC_MODE $SPI $rhost_addr $lhost_addr
 fi
 
-# Make sure the connectvity
-case $IP_VER in
-    4)
-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-    if [ $ret -ne 0 ]; then
-	tst_resm TBROK "There is no IPv4 connectivity."
-	exit 1
-    fi
-    ;;
-
-    6)
-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-    if [ $ret -ne 0 ]; then
-	tst_resm TBROK "There is no IPv6 connectivity."
-	exit 1
-    fi
-    ;;
-esac
-
-
 #-----------------------------------------------------------------------
 #
 # Main
 #
 #
 
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
-
-sleep $NS_DURATION
-killall_icmp_traffic
-wait
+# Make sure the connectvity
+for msg_size in $ICMP_SIZE_ARRAY; do
+    tst_ping $lhost_ifname $rhost_addr $msg_size
+    if [ $? -ne 0 ]; then
+        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
+    else
+        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
+    fi
+done
 
 #-----------------------------------------------------------------------
 #
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 2/3] network/stress: add ipsec lib
  2016-03-17 10:04 ` [LTP] [PATCHv3 2/3] network/stress: add ipsec lib Hangbin Liu
@ 2016-03-22 12:51   ` Alexey Kodanev
  2016-03-22 13:36     ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-03-22 12:51 UTC (permalink / raw)
  To: ltp

Hi,
On 03/17/2016 01:04 PM, Hangbin Liu wrote:
> Signed-off-by: Hangbin Liu <haliu@redhat.com>
> ---
>   testcases/network/stress/ipsec/Makefile     |  29 ++++++++
>   testcases/network/stress/ipsec/ipsec_lib.sh | 111 ++++++++++++++++++++++++++++
>   2 files changed, 140 insertions(+)
>   create mode 100644 testcases/network/stress/ipsec/Makefile
>   create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh
>
> diff --git a/testcases/network/stress/ipsec/Makefile b/testcases/network/stress/ipsec/Makefile
> new file mode 100644
> index 0000000..0d7f1b6
> --- /dev/null
> +++ b/testcases/network/stress/ipsec/Makefile
> @@ -0,0 +1,29 @@
> +#!/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, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#

Forgot to change it here?

> +# Author: Hangbin Liu <haliu@redhat.com>
> +#
> +#######################################################################
> +
> +
> +top_srcdir		?= ../../../..
> +
> +include $(top_srcdir)/include/mk/env_pre.mk
> +
> +INSTALL_TARGETS		:= *.sh
> +
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
> new file mode 100644
> index 0000000..33716ce
> --- /dev/null
> +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> @@ -0,0 +1,111 @@
> +#!/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 <haliu@redhat.com>
> +#
> +#######################################################################
> +
> +. test_net.sh
> +
> +# tst_ipsec flush: flush the ipsec state and policy
> +# tst_ipsec target protocol mode spi src_addr dst_addr: config ipsec
> +#
> +# target: target of the configuration file ( src / dst )
> +# protocol: ah / esp / ipcomp
> +# mode: transport / tunnel
> +# spi: the first spi value
> +# src_addr: source IP address
> +# dst_addr: destination IP address
> +tst_ipsec()
> +{
> +	if [ "$1" = "flush" ]; then
> +		ROD ip xfrm state flush
> +		ROD ip xfrm policy flush
> +		tst_rhost_run -s -c "ip xfrm state flush && ip xfrm policy flush"
> +		return 0
> +	fi

I'd move it to another function, we could name ittst_ipsec_cleanup().
And tst_ipsec() needs some general description like what it actually does.

> +	if [ $# -ne 6 ]; then
> +		tst_resm TINFO "tst_ipsec parameter mismatch"
> +		return 1
> +	fi

Why not just tst_brkm() here?

> +
> +	target=$1
> +	protocol=$2
> +	mode=$3
> +	spi=$4
> +	src=$5
> +	dst=$6

It's better to make these variables to be defined in function scope
(as local) and other variables which used only inside the function.

> +
> +	# Encryption algorithm
> +	EALGO="des3_ede"
> +	EALGO_KEY=0x$(printf _I_want_to_have_chicken_ | hexdump -ve '/1 "%x"')
> +
> +	# Authentication algorithm
> +	AALGO="sha1"
> +	AALGO_KEY=0x$(printf beef_fish_pork_salad | hexdump -ve '/1 "%x"')

if we use hexdump, we should verify it with tst_check_cmds()
(e.g. when we source the library).

> +
> +	# Compression algorithm
> +	CALGO="deflate"
> +	# Algorithm options for each protocol
> +	case $protocol in
> +	ah)
> +		algo_line="auth $AALGO $AALGO_KEY"
> +		proto="ah"
> +		;;
> +	esp)
> +		algo_line="enc $EALGO $EALGO_KEY auth $AALGO $AALGO_KEY"
> +		proto="esp"
> +		;;
> +	ipcomp)
> +		algo_line="comp $CALGO"
> +		proto="comp"
> +		;;
> +	*)
> +		tst_resm TINFO "tst_ipsec protocol mismatch"
> +		return 1
> +		;;
> +	esac

I would add tst_brkm() here as well.

> +
> +	if [ $target = src ]; then
> +		spi_1="0x$spi"
> +		spi_2="0x$(( $spi + 1 ))"
> +		ROD ip xfrm state add src $src dst $dst spi $spi_1 proto $proto \
> +			$algo_line mode $mode sel src $src dst $dst
> +		ROD ip xfrm policy add src $src dst $dst dir out tmpl src $src \
> +			dst $dst proto $proto mode $mode
> +
> +		ROD ip xfrm state add src $dst dst $src spi $spi_2 proto $proto \
> +			$algo_line mode $mode sel src $dst dst $src
> +		ROD ip xfrm policy add src $dst dst $src dir in tmpl src $dst \
> +			dst $src proto $proto mode $mode level use
> +		ROD ip xfrm state
> +		ROD ip xfrm policy
> +	elif [ $target = dst ]; then
> +		spi_1="0x$(( $spi + 1 ))"
> +		spi_2="0x$spi"
> +		tst_rhost_run -s -c "ip xfrm state add src $src dst $dst spi $spi_1 \
> +			proto $proto $algo_line mode $mode sel src $src dst $dst"
> +		tst_rhost_run -s -c "ip xfrm policy add src $src dst $dst dir out \
> +			tmpl src $src dst $dst proto $proto mode $mode"
> +
> +		tst_rhost_run -s -c "ip xfrm state add src $dst dst $src spi $spi_2 \
> +			proto $proto $algo_line mode $mode sel src $dst dst $src"
> +		tst_rhost_run -s -c "ip xfrm policy add src $dst dst $src dir in \
> +			tmpl src $dst dst $src proto $proto mode $mode level use"
> +		tst_rhost_run -s -c "ip xfrm state"
> +		tst_rhost_run -s -c "ip xfrm policy"
> +	fi
> +}

Can we stick with lhost/rhost naming, and lhost to be default value?
So it would be similar to test_net.sh...

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-17 10:04 ` [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing Hangbin Liu
@ 2016-03-22 13:34   ` Alexey Kodanev
  2016-03-23  2:02     ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-03-22 13:34 UTC (permalink / raw)
  To: ltp


On 03/17/2016 01:04 PM, Hangbin Liu wrote:
> Also check each msg_size in $ICMP_SIZE_ARRAY to make sure the connectvity.
>
> Signed-off-by: Hangbin Liu <haliu@redhat.com>
> ---
>   .../stress/icmp/uni-basic/icmp4-uni-basic01        | 160 ++++-----------------
>   1 file changed, 24 insertions(+), 136 deletions(-)
>
> diff --git a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01 b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> index b78ac8f..7c23cc7 100644
> --- a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> +++ b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> @@ -42,17 +42,13 @@
>   #	Oct 19 2005 - Created (Mitsuru Chinen)
>   #
>   #-----------------------------------------------------------------------
> -# Uncomment line below for debug output.
> -#trace_logic=${trace_logic:-"set -x"}
> -$trace_logic
> -
>   # The test case ID, the test case count and the total number of test case
>   TCID=${TCID:-icmp4-uni-basic01}
>   TST_TOTAL=1
>   TST_COUNT=1
> -export TCID
> -export TST_COUNT
> -export TST_TOTAL
> +TST_CLEANUP="do_cleanup"
> +
> +. ipsec_lib.sh
>   
>   # Test description
>   tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending various size of ICMP message with the following conditions"
> @@ -61,9 +57,6 @@ tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending
>   LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
>   export LTPROOT
>   
> -# Check the environmanet variable
> -. check_envval || exit $TST_TOTAL
> -
>   # Dulation of the test [sec]
>   NS_DURATION=${NS_DURATION:-3600}      # 1 hour
>   

I'd remove defining these variables here... in the test. Weshouldhave 
them already
defined in network.sh or it could be done in test_net.sh in case we're 
not going to
runnetwork.sh.

> @@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
>   
>   # The version of IP
>   IP_VER=${IP_VER:-4}
> +[ $IP_VER -eq 6 ] && TST_IPV6=6
>   

just "ipv=${TST_IPV6:-4}" instead of two lines.

>   # true, if ipsec is used
>   DO_IPSEC=${DO_IPSEC:-false}
> @@ -100,16 +94,8 @@ ICMP_SIZE_ARRAY=${ICMP_SIZE_ARRAY:-"10 100 1000 10000 65507"}
>   #-----------------------------------------------------------------------
>   do_cleanup()
>   {
> -    # Kill the icmp traffic server
> -    killall_icmp_traffic
> -
>       # Unset SAD/SPD
> -    output_ipsec_conf flush | setkey -c >/dev/null 2>&1
> -    $LTP_RSH $RHOST ${LTPROOT}/'testcases/bin/output_ipsec_conf flush | PATH=/sbin:/usr/sbin:$PATH setkey -c' >/dev/null 2>&1
> -
> -    # Clean up each interface
> -    initialize_if lhost ${LINK_NUM}
> -    initialize_if rhost ${LINK_NUM}
> +    tst_ipsec flush
> }

TST_CLEANUP=tst_ipsec_cleanup

>   @@ -127,10 +113,9 @@ tst_resm TINFO "- Version of IP is IPv${IP_VER}"
>   tst_resm TINFO "- Size of packets are ( $ICMP_SIZE_ARRAY )"
>   
>   if $DO_IPSEC ; then
> -    message=`check_setkey`
> +    message=`ip xfrm state`
>       if [ $? -ne 0 ]; then
> -	tst_resm TBROK "$message"
> -	exit 1
> +	tst_brkm TBROK "$message"
>       fi
>   
>       case $IPSEC_PROTO in
> @@ -147,16 +132,14 @@ if $DO_IPSEC ; then
>   fi
>   
>   # name of interface of the local/remote host
> -lhost_ifname=`get_ifname lhost $LINK_NUM`
> +lhost_ifname=`tst_iface lhost $LINK_NUM`
>   if [ $? -ne 0 ]; then
> -    tst_resm TBROK "Failed to get the interface name at the local host"
> -    exit $TST_TOTAL
> +    tst_brkm TBROK "Failed to get the interface name at the local host"

These checks seems useless.

>   fi
>   
> -rhost_ifname=`get_ifname rhost $LINK_NUM`
> +rhost_ifname=`tst_iface rhost $LINK_NUM`
>   if [ $? -ne 0 ]; then
> -    tst_resm TBROK "Failed to get the interface name at the remote host"
> -    exit $TST_TOTAL
> +    tst_brkm TBROK "Failed to get the interface name at the remote host"
>   fi

Here as well.

>   
>   # Initialize the system configuration
> @@ -165,125 +148,30 @@ do_cleanup
>   # Call do_cleanup function before exit
>   trap do_cleanup 0
>   
> -# Configurate IP addresses
> -case $IP_VER in
> -    4)
> -    # Network portion of the IPv4 address
> -    network_part=${IPV4_NETWORK:-"10.0.0"}
> -
> -    # Netmask of the IPv4 network
> -    network_mask=24
> -
> -    # Host portion of the IPv4 address
> -    lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
> -    rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
> -
> -    # Set IPv4 addresses to the interfaces
> -    set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
> -    if [ $? -ne 0 ]; then
> -	tst_resm TBROK "Failed to add any IP address at the local host"
> -	exit 1
> -    fi
> -
> -    set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
> -    if [ $? -ne 0 ]; then
> -	tst_resm TBROK "Failed to add any IP address at the remote host"
> -	exit 1
> -    fi
> -
> -    # IPv4 address of the local/remote host
> -    lhost_addr="${network_part}.${lhost_host_part}"
> -    rhost_addr="${network_part}.${rhost_host_part}"
> -    ;;
> -
> -    6)
> -    # Network portion of the IPv6 address
> -    network_part="fd00:1:1:1"
> -
> -    # Netmask of the IPv6 network
> -    network_mask=64
> -
> -    # Host portion of the IPv6 address
> -    lhost_host_part=":2"     # local host
> -    rhost_host_part=":1"     # remote host
> -
> -    # Set IPv6 addresses to the interfaces
> -    add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
> -    if [ $? -ne 0 ]; then
> -	tst_resm TBROK "Failed to add any IP address at the local host"
> -	exit 1
> -    fi
> -
> -    add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
> -    if [ $? -ne 0 ]; then
> -	tst_resm TBROK "Failed to add any IP address at the remote host"
> -	exit 1
> -    fi
> -
> -    # IPv6 address of the local/remote host
> -    lhost_addr="${network_part}:${lhost_host_part}"
> -    rhost_addr="${network_part}:${rhost_host_part}"
> -    ;;
> -
> -    *)
> -    tst_resm TBROK "Unknown IP version"
> -    ;;
> -esac
> +lhost_addr=$(tst_ipaddr)
> +rhost_addr=$(tst_ipaddr rhost)
>   
>   # Configure SAD/SPD
>   if $DO_IPSEC ; then
> -    ipsec_log=`mktemp -p $TMPDIR`
> -
> -    output_ipsec_conf src \
> -	$IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr \
> -	    |  setkey -c 2>&1 | tee $ipsec_log
> -    if [ $? -ne 0 -o -s $ipsec_log ]; then
> -	tst_resm TBROK "Failed to configure SAD/SPD on the local host."
> -	rm -f $ipsec_log
> -	exit 1
> -    fi
> -
> -    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/output_ipsec_conf dst $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr' | PATH=/sbin:/usr/sbin:$PATH setkey -c' 2>&1 | tee $ipsec_log
> -    if [ $? -ne 0 -o -s $ipsec_log ]; then
> -	tst_resm TBROK "Failed to configure SAD/SPD on the remote host."
> -	rm -f $ipsec_log
> -	exit 1
> -    fi
> -    rm -f $ipsec_log
> +    tst_ipsec src $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr
> +    tst_ipsec dst $IPSEC_PROTO $IPSEC_MODE $SPI $rhost_addr $lhost_addr
>   fi
>   
> -# Make sure the connectvity
> -case $IP_VER in
> -    4)
> -    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
> -    if [ $ret -ne 0 ]; then
> -	tst_resm TBROK "There is no IPv4 connectivity."
> -	exit 1
> -    fi
> -    ;;
> -
> -    6)
> -    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
> -    if [ $ret -ne 0 ]; then
> -	tst_resm TBROK "There is no IPv6 connectivity."
> -	exit 1
> -    fi
> -    ;;
> -esac
> -
> -
>   #-----------------------------------------------------------------------
>   #
>   # Main
>   #
>   #
>   
> -# Run a client
> -$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
> -
> -sleep $NS_DURATION
> -killall_icmp_traffic
> -wait
> +# Make sure the connectvity
> +for msg_size in $ICMP_SIZE_ARRAY; do
> +    tst_ping $lhost_ifname $rhost_addr $msg_size
> +    if [ $? -ne 0 ]; then
> +        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
> +    else
> +        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
> +    fi
> +done


Is it really needed to ping with different message sizes? if yes, we 
couldadd this
functionality to tst_ping().

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 2/3] network/stress: add ipsec lib
  2016-03-22 12:51   ` Alexey Kodanev
@ 2016-03-22 13:36     ` Hangbin Liu
  0 siblings, 0 replies; 16+ messages in thread
From: Hangbin Liu @ 2016-03-22 13:36 UTC (permalink / raw)
  To: ltp

Hi Alexey,

Thanks for all the advise. I will fix them soon.

Regards
Hangbin
On Tue, Mar 22, 2016 at 03:51:58PM +0300, Alexey Kodanev wrote:
> Hi,
> On 03/17/2016 01:04 PM, Hangbin Liu wrote:
> >Signed-off-by: Hangbin Liu <haliu@redhat.com>
> >---
> >  testcases/network/stress/ipsec/Makefile     |  29 ++++++++
> >  testcases/network/stress/ipsec/ipsec_lib.sh | 111 ++++++++++++++++++++++++++++
> >  2 files changed, 140 insertions(+)
> >  create mode 100644 testcases/network/stress/ipsec/Makefile
> >  create mode 100644 testcases/network/stress/ipsec/ipsec_lib.sh
> >
> >diff --git a/testcases/network/stress/ipsec/Makefile b/testcases/network/stress/ipsec/Makefile
> >new file mode 100644
> >index 0000000..0d7f1b6
> >--- /dev/null
> >+++ b/testcases/network/stress/ipsec/Makefile
> >@@ -0,0 +1,29 @@
> >+#!/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, write the Free Software Foundation,
> >+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> >+#
> 
> Forgot to change it here?
> 
> >+# Author: Hangbin Liu <haliu@redhat.com>
> >+#
> >+#######################################################################
> >+
> >+
> >+top_srcdir		?= ../../../..
> >+
> >+include $(top_srcdir)/include/mk/env_pre.mk
> >+
> >+INSTALL_TARGETS		:= *.sh
> >+
> >+include $(top_srcdir)/include/mk/generic_leaf_target.mk
> >diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
> >new file mode 100644
> >index 0000000..33716ce
> >--- /dev/null
> >+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> >@@ -0,0 +1,111 @@
> >+#!/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 <haliu@redhat.com>
> >+#
> >+#######################################################################
> >+
> >+. test_net.sh
> >+
> >+# tst_ipsec flush: flush the ipsec state and policy
> >+# tst_ipsec target protocol mode spi src_addr dst_addr: config ipsec
> >+#
> >+# target: target of the configuration file ( src / dst )
> >+# protocol: ah / esp / ipcomp
> >+# mode: transport / tunnel
> >+# spi: the first spi value
> >+# src_addr: source IP address
> >+# dst_addr: destination IP address
> >+tst_ipsec()
> >+{
> >+	if [ "$1" = "flush" ]; then
> >+		ROD ip xfrm state flush
> >+		ROD ip xfrm policy flush
> >+		tst_rhost_run -s -c "ip xfrm state flush && ip xfrm policy flush"
> >+		return 0
> >+	fi
> 
> I'd move it to another function, we could name ittst_ipsec_cleanup().
> And tst_ipsec() needs some general description like what it actually does.
> 
> >+	if [ $# -ne 6 ]; then
> >+		tst_resm TINFO "tst_ipsec parameter mismatch"
> >+		return 1
> >+	fi
> 
> Why not just tst_brkm() here?
> 
> >+
> >+	target=$1
> >+	protocol=$2
> >+	mode=$3
> >+	spi=$4
> >+	src=$5
> >+	dst=$6
> 
> It's better to make these variables to be defined in function scope
> (as local) and other variables which used only inside the function.
> 
> >+
> >+	# Encryption algorithm
> >+	EALGO="des3_ede"
> >+	EALGO_KEY=0x$(printf _I_want_to_have_chicken_ | hexdump -ve '/1 "%x"')
> >+
> >+	# Authentication algorithm
> >+	AALGO="sha1"
> >+	AALGO_KEY=0x$(printf beef_fish_pork_salad | hexdump -ve '/1 "%x"')
> 
> if we use hexdump, we should verify it with tst_check_cmds()
> (e.g. when we source the library).
> 
> >+
> >+	# Compression algorithm
> >+	CALGO="deflate"
> >+	# Algorithm options for each protocol
> >+	case $protocol in
> >+	ah)
> >+		algo_line="auth $AALGO $AALGO_KEY"
> >+		proto="ah"
> >+		;;
> >+	esp)
> >+		algo_line="enc $EALGO $EALGO_KEY auth $AALGO $AALGO_KEY"
> >+		proto="esp"
> >+		;;
> >+	ipcomp)
> >+		algo_line="comp $CALGO"
> >+		proto="comp"
> >+		;;
> >+	*)
> >+		tst_resm TINFO "tst_ipsec protocol mismatch"
> >+		return 1
> >+		;;
> >+	esac
> 
> I would add tst_brkm() here as well.
> 
> >+
> >+	if [ $target = src ]; then
> >+		spi_1="0x$spi"
> >+		spi_2="0x$(( $spi + 1 ))"
> >+		ROD ip xfrm state add src $src dst $dst spi $spi_1 proto $proto \
> >+			$algo_line mode $mode sel src $src dst $dst
> >+		ROD ip xfrm policy add src $src dst $dst dir out tmpl src $src \
> >+			dst $dst proto $proto mode $mode
> >+
> >+		ROD ip xfrm state add src $dst dst $src spi $spi_2 proto $proto \
> >+			$algo_line mode $mode sel src $dst dst $src
> >+		ROD ip xfrm policy add src $dst dst $src dir in tmpl src $dst \
> >+			dst $src proto $proto mode $mode level use
> >+		ROD ip xfrm state
> >+		ROD ip xfrm policy
> >+	elif [ $target = dst ]; then
> >+		spi_1="0x$(( $spi + 1 ))"
> >+		spi_2="0x$spi"
> >+		tst_rhost_run -s -c "ip xfrm state add src $src dst $dst spi $spi_1 \
> >+			proto $proto $algo_line mode $mode sel src $src dst $dst"
> >+		tst_rhost_run -s -c "ip xfrm policy add src $src dst $dst dir out \
> >+			tmpl src $src dst $dst proto $proto mode $mode"
> >+
> >+		tst_rhost_run -s -c "ip xfrm state add src $dst dst $src spi $spi_2 \
> >+			proto $proto $algo_line mode $mode sel src $dst dst $src"
> >+		tst_rhost_run -s -c "ip xfrm policy add src $dst dst $src dir in \
> >+			tmpl src $dst dst $src proto $proto mode $mode level use"
> >+		tst_rhost_run -s -c "ip xfrm state"
> >+		tst_rhost_run -s -c "ip xfrm policy"
> >+	fi
> >+}
> 
> Can we stick with lhost/rhost naming, and lhost to be default value?
> So it would be similar to test_net.sh...
> 
> Best regards,
> Alexey
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 

Thanks & Best Regards
Hangbin Liu <haliu@redhat.com>
Leo on #kernel-qe, #kernel, #eng-china

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-22 13:34   ` Alexey Kodanev
@ 2016-03-23  2:02     ` Hangbin Liu
  2016-03-23  8:21       ` Alexey Kodanev
  0 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-03-23  2:02 UTC (permalink / raw)
  To: ltp

Hi,

On Tue, Mar 22, 2016 at 04:34:52PM +0300, Alexey Kodanev wrote:
> 
> On 03/17/2016 01:04 PM, Hangbin Liu wrote:
> >Also check each msg_size in $ICMP_SIZE_ARRAY to make sure the connectvity.
> >
> >Signed-off-by: Hangbin Liu <haliu@redhat.com>
> >---
> >  .../stress/icmp/uni-basic/icmp4-uni-basic01        | 160 ++++-----------------
> >  1 file changed, 24 insertions(+), 136 deletions(-)
> >
> >diff --git a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01 b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> >index b78ac8f..7c23cc7 100644
> >--- a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> >+++ b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
> >@@ -42,17 +42,13 @@
> >  #	Oct 19 2005 - Created (Mitsuru Chinen)
> >  #
> >  #-----------------------------------------------------------------------
> >-# Uncomment line below for debug output.
> >-#trace_logic=${trace_logic:-"set -x"}
> >-$trace_logic
> >-
> >  # The test case ID, the test case count and the total number of test case
> >  TCID=${TCID:-icmp4-uni-basic01}
> >  TST_TOTAL=1
> >  TST_COUNT=1
> >-export TCID
> >-export TST_COUNT
> >-export TST_TOTAL
> >+TST_CLEANUP="do_cleanup"
> >+
> >+. ipsec_lib.sh
> >  # Test description
> >  tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending various size of ICMP message with the following conditions"
> >@@ -61,9 +57,6 @@ tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending
> >  LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
> >  export LTPROOT
> >-# Check the environmanet variable
> >-. check_envval || exit $TST_TOTAL
> >-
> >  # Dulation of the test [sec]
> >  NS_DURATION=${NS_DURATION:-3600}      # 1 hour
> 
> I'd remove defining these variables here... in the test. Weshouldhave them
> already
> defined in network.sh or it could be done in test_net.sh in case we're not
> going to
> runnetwork.sh.

OK, I will remove this
> 
> >@@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
> >  # The version of IP
> >  IP_VER=${IP_VER:-4}
> >+[ $IP_VER -eq 6 ] && TST_IPV6=6
> 
> just "ipv=${TST_IPV6:-4}" instead of two lines.

This is not work. Because test_net.sh will set TST_IPV6= , and icmp4-uni-basic01
need source it before test. The relation looks like

icmp6-uni-basic01
  . icmp4-uni-basic01
    . ipsec_lib.sh
      . test_net.sh

If we want to use like ipv=${TST_IPV6:-4}, we need source test_net.sh in all
sub-testcases instead of in ipsec_lib.sh. Which will like

icmp6-uni-basic01
  . test_net.sh
  . icmp4-uni-basic01
    . ipsec_lib.sh

> 
> >  # true, if ipsec is used
> >  DO_IPSEC=${DO_IPSEC:-false}
> >@@ -100,16 +94,8 @@ ICMP_SIZE_ARRAY=${ICMP_SIZE_ARRAY:-"10 100 1000 10000 65507"}
> >  #-----------------------------------------------------------------------
> >  do_cleanup()
> >  {
> >-    # Kill the icmp traffic server
> >-    killall_icmp_traffic
> >-
> >      # Unset SAD/SPD
> >-    output_ipsec_conf flush | setkey -c >/dev/null 2>&1
> >-    $LTP_RSH $RHOST ${LTPROOT}/'testcases/bin/output_ipsec_conf flush | PATH=/sbin:/usr/sbin:$PATH setkey -c' >/dev/null 2>&1
> >-
> >-    # Clean up each interface
> >-    initialize_if lhost ${LINK_NUM}
> >-    initialize_if rhost ${LINK_NUM}
> >+    tst_ipsec flush
> >}
> 
> TST_CLEANUP=tst_ipsec_cleanup
> 
> >  @@ -127,10 +113,9 @@ tst_resm TINFO "- Version of IP is IPv${IP_VER}"
> >  tst_resm TINFO "- Size of packets are ( $ICMP_SIZE_ARRAY )"
> >  if $DO_IPSEC ; then
> >-    message=`check_setkey`
> >+    message=`ip xfrm state`
> >      if [ $? -ne 0 ]; then
> >-	tst_resm TBROK "$message"
> >-	exit 1
> >+	tst_brkm TBROK "$message"
> >      fi
> >      case $IPSEC_PROTO in
> >@@ -147,16 +132,14 @@ if $DO_IPSEC ; then
> >  fi
> >  # name of interface of the local/remote host
> >-lhost_ifname=`get_ifname lhost $LINK_NUM`
> >+lhost_ifname=`tst_iface lhost $LINK_NUM`
> >  if [ $? -ne 0 ]; then
> >-    tst_resm TBROK "Failed to get the interface name at the local host"
> >-    exit $TST_TOTAL
> >+    tst_brkm TBROK "Failed to get the interface name at the local host"
> 
> These checks seems useless.
> 
> >  fi
> >-rhost_ifname=`get_ifname rhost $LINK_NUM`
> >+rhost_ifname=`tst_iface rhost $LINK_NUM`
> >  if [ $? -ne 0 ]; then
> >-    tst_resm TBROK "Failed to get the interface name at the remote host"
> >-    exit $TST_TOTAL
> >+    tst_brkm TBROK "Failed to get the interface name at the remote host"
> >  fi
> 
> Here as well.

OK, will remove these checks.
> 
> >  # Initialize the system configuration
> >@@ -165,125 +148,30 @@ do_cleanup
> >  # Call do_cleanup function before exit
> >  trap do_cleanup 0
> >-# Configurate IP addresses
> >-case $IP_VER in
> >-    4)
> >-    # Network portion of the IPv4 address
> >-    network_part=${IPV4_NETWORK:-"10.0.0"}
> >-
> >-    # Netmask of the IPv4 network
> >-    network_mask=24
> >-
> >-    # Host portion of the IPv4 address
> >-    lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
> >-    rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
> >-
> >-    # Set IPv4 addresses to the interfaces
> >-    set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
> >-    if [ $? -ne 0 ]; then
> >-	tst_resm TBROK "Failed to add any IP address at the local host"
> >-	exit 1
> >-    fi
> >-
> >-    set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
> >-    if [ $? -ne 0 ]; then
> >-	tst_resm TBROK "Failed to add any IP address at the remote host"
> >-	exit 1
> >-    fi
> >-
> >-    # IPv4 address of the local/remote host
> >-    lhost_addr="${network_part}.${lhost_host_part}"
> >-    rhost_addr="${network_part}.${rhost_host_part}"
> >-    ;;
> >-
> >-    6)
> >-    # Network portion of the IPv6 address
> >-    network_part="fd00:1:1:1"
> >-
> >-    # Netmask of the IPv6 network
> >-    network_mask=64
> >-
> >-    # Host portion of the IPv6 address
> >-    lhost_host_part=":2"     # local host
> >-    rhost_host_part=":1"     # remote host
> >-
> >-    # Set IPv6 addresses to the interfaces
> >-    add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
> >-    if [ $? -ne 0 ]; then
> >-	tst_resm TBROK "Failed to add any IP address at the local host"
> >-	exit 1
> >-    fi
> >-
> >-    add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
> >-    if [ $? -ne 0 ]; then
> >-	tst_resm TBROK "Failed to add any IP address at the remote host"
> >-	exit 1
> >-    fi
> >-
> >-    # IPv6 address of the local/remote host
> >-    lhost_addr="${network_part}:${lhost_host_part}"
> >-    rhost_addr="${network_part}:${rhost_host_part}"
> >-    ;;
> >-
> >-    *)
> >-    tst_resm TBROK "Unknown IP version"
> >-    ;;
> >-esac
> >+lhost_addr=$(tst_ipaddr)
> >+rhost_addr=$(tst_ipaddr rhost)
> >  # Configure SAD/SPD
> >  if $DO_IPSEC ; then
> >-    ipsec_log=`mktemp -p $TMPDIR`
> >-
> >-    output_ipsec_conf src \
> >-	$IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr \
> >-	    |  setkey -c 2>&1 | tee $ipsec_log
> >-    if [ $? -ne 0 -o -s $ipsec_log ]; then
> >-	tst_resm TBROK "Failed to configure SAD/SPD on the local host."
> >-	rm -f $ipsec_log
> >-	exit 1
> >-    fi
> >-
> >-    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/output_ipsec_conf dst $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr' | PATH=/sbin:/usr/sbin:$PATH setkey -c' 2>&1 | tee $ipsec_log
> >-    if [ $? -ne 0 -o -s $ipsec_log ]; then
> >-	tst_resm TBROK "Failed to configure SAD/SPD on the remote host."
> >-	rm -f $ipsec_log
> >-	exit 1
> >-    fi
> >-    rm -f $ipsec_log
> >+    tst_ipsec src $IPSEC_PROTO $IPSEC_MODE $SPI $lhost_addr $rhost_addr
> >+    tst_ipsec dst $IPSEC_PROTO $IPSEC_MODE $SPI $rhost_addr $lhost_addr
> >  fi
> >-# Make sure the connectvity
> >-case $IP_VER in
> >-    4)
> >-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
> >-    if [ $ret -ne 0 ]; then
> >-	tst_resm TBROK "There is no IPv4 connectivity."
> >-	exit 1
> >-    fi
> >-    ;;
> >-
> >-    6)
> >-    ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
> >-    if [ $ret -ne 0 ]; then
> >-	tst_resm TBROK "There is no IPv6 connectivity."
> >-	exit 1
> >-    fi
> >-    ;;
> >-esac
> >-
> >-
> >  #-----------------------------------------------------------------------
> >  #
> >  # Main
> >  #
> >  #
> >-# Run a client
> >-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
> >-
> >-sleep $NS_DURATION
> >-killall_icmp_traffic
> >-wait
> >+# Make sure the connectvity
> >+for msg_size in $ICMP_SIZE_ARRAY; do
> >+    tst_ping $lhost_ifname $rhost_addr $msg_size
> >+    if [ $? -ne 0 ]; then
> >+        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
> >+    else
> >+        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
> >+    fi
> >+done
> 
> 
> Is it really needed to ping with different message sizes? if yes, we
> couldadd this
> functionality to tst_ping().

Yes, we need to make sure ipsec can handle all kinds of message size. But we
could not make it in tst_ping because ah/esp and tunnel/transport have
different header length. e.g. when there is no ipsec, the max playload is
65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
make tst_ping to handle all these scenarios.

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-23  2:02     ` Hangbin Liu
@ 2016-03-23  8:21       ` Alexey Kodanev
  2016-03-23 13:30         ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-03-23  8:21 UTC (permalink / raw)
  To: ltp

Hi,
On 03/23/2016 05:02 AM, Hangbin Liu wrote:
> Hi,
>
> On Tue, Mar 22, 2016 at 04:34:52PM +0300, Alexey Kodanev wrote:
>> On 03/17/2016 01:04 PM, Hangbin Liu wrote:
>>> Also check each msg_size in $ICMP_SIZE_ARRAY to make sure the connectvity.
>>>
>>> Signed-off-by: Hangbin Liu <haliu@redhat.com>
>>> ---
>>>   .../stress/icmp/uni-basic/icmp4-uni-basic01        | 160 ++++-----------------
>>>   1 file changed, 24 insertions(+), 136 deletions(-)
>>>
>>> diff --git a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01 b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
>>> index b78ac8f..7c23cc7 100644
>>> --- a/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
>>> +++ b/testcases/network/stress/icmp/uni-basic/icmp4-uni-basic01
>>> @@ -42,17 +42,13 @@
>>>   #	Oct 19 2005 - Created (Mitsuru Chinen)
>>>   #
>>>   #-----------------------------------------------------------------------
>>> -# Uncomment line below for debug output.
>>> -#trace_logic=${trace_logic:-"set -x"}
>>> -$trace_logic
>>> -
>>>   # The test case ID, the test case count and the total number of test case
>>>   TCID=${TCID:-icmp4-uni-basic01}
>>>   TST_TOTAL=1
>>>   TST_COUNT=1
>>> -export TCID
>>> -export TST_COUNT
>>> -export TST_TOTAL
>>> +TST_CLEANUP="do_cleanup"
>>> +
>>> +. ipsec_lib.sh
>>>   # Test description
>>>   tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending various size of ICMP message with the following conditions"
>>> @@ -61,9 +57,6 @@ tst_resm TINFO "Verify that the kernel is not crashed with receiving and sending
>>>   LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
>>>   export LTPROOT
>>> -# Check the environmanet variable
>>> -. check_envval || exit $TST_TOTAL
>>> -
>>>   # Dulation of the test [sec]
>>>   NS_DURATION=${NS_DURATION:-3600}      # 1 hour
>> I'd remove defining these variables here... in the test. Weshouldhave them
>> already
>> defined in network.sh or it could be done in test_net.sh in case we're not
>> going to
>> runnetwork.sh.
> OK, I will remove this
>>> @@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
>>>   # The version of IP
>>>   IP_VER=${IP_VER:-4}
>>> +[ $IP_VER -eq 6 ] && TST_IPV6=6
>> just "ipv=${TST_IPV6:-4}" instead of two lines.
> This is not work. Because test_net.sh will set TST_IPV6= , and icmp4-uni-basic01
> need source it before test. The relation looks like
>
> icmp6-uni-basic01
>    . icmp4-uni-basic01
>      . ipsec_lib.sh
>        . test_net.sh
>
> If we want to use like ipv=${TST_IPV6:-4}, we need source test_net.sh in all
> sub-testcases instead of in ipsec_lib.sh. Which will like
>
> icmp6-uni-basic01
>    . test_net.sh
>    . icmp4-uni-basic01
>      . ipsec_lib.sh

Could you add "ipv=..." to ipsec_lib.sh and we wouldn't set it in every 
test-case?

BTW, does the attached patch help in the first case (added export to 
TST_IPV6)?


>> -# Run a client
>> -$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
>> -
>> -sleep $NS_DURATION
>> -killall_icmp_traffic
>> -wait
>> +# Make sure the connectvity
>> +for msg_size in $ICMP_SIZE_ARRAY; do
>> +    tst_ping $lhost_ifname $rhost_addr $msg_size
>> +    if [ $? -ne 0 ]; then
>> +        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
>> +    else
>> +        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
>> +    fi
>> +done
>>
>> Is it really needed to ping with different message sizes? if yes, we
>> couldadd this
>> functionality to tst_ping().
> Yes, we need to make sure ipsec can handle all kinds of message size. But we
> could not make it in tst_ping because ah/esp and tunnel/transport have
> different header length. e.g. when there is no ipsec, the max playload is
> 65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
> make tst_ping to handle all these scenarios.

I thought we could add variable length parameters, something like this

tst_ping p1 ... pN $ICMP_SIZE_ARRAY

tst_ping()
{
     local msg_sizes=${@:N+1}

     for size in msg_sizes; do
     ...
}


Best regards,
Alexey

> Thanks
> Hangbin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-testcases-lib-test_net.sh-export-TST_IPV6-var.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160323/29814bb0/attachment-0001.bin>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-23  8:21       ` Alexey Kodanev
@ 2016-03-23 13:30         ` Hangbin Liu
  2016-03-28 10:09           ` Alexey Kodanev
  0 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-03-23 13:30 UTC (permalink / raw)
  To: ltp

Hi,
On Wed, Mar 23, 2016 at 11:21:37AM +0300, Alexey Kodanev wrote:
> Hi,
> >>>@@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
> >>>  # The version of IP
> >>>  IP_VER=${IP_VER:-4}
> >>>+[ $IP_VER -eq 6 ] && TST_IPV6=6
> >>just "ipv=${TST_IPV6:-4}" instead of two lines.
> >This is not work. Because test_net.sh will set TST_IPV6= , and icmp4-uni-basic01
> >need source it before test. The relation looks like
> >
> >icmp6-uni-basic01
> >   . icmp4-uni-basic01
> >     . ipsec_lib.sh
> >       . test_net.sh
> >
> >If we want to use like ipv=${TST_IPV6:-4}, we need source test_net.sh in all
> >sub-testcases instead of in ipsec_lib.sh. Which will like
> >
> >icmp6-uni-basic01
> >   . test_net.sh
> >   . icmp4-uni-basic01
> >     . ipsec_lib.sh
> 
> Could you add "ipv=..." to ipsec_lib.sh and we wouldn't set it in every
> test-case?

the IP_VER is to describe what the test run for. We shouldn't add it in
ipsec_lib.sh. There is no relations between them.

> 
> BTW, does the attached patch help in the first case (added export to
> TST_IPV6)?

I'm afraid not. I'd tried to use like

icmp4-uni-basic01 icmp4-uni-basic01
icmp6-uni-basic01 icmp4-uni-basic01 -6

Then I find this is not only different of IP version, ipsec protocol, mode. But
also different message sizes. So I give up to use like that.

> 
> 
> >>-# Run a client
> >>-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
> >>-
> >>-sleep $NS_DURATION
> >>-killall_icmp_traffic
> >>-wait
> >>+# Make sure the connectvity
> >>+for msg_size in $ICMP_SIZE_ARRAY; do
> >>+    tst_ping $lhost_ifname $rhost_addr $msg_size
> >>+    if [ $? -ne 0 ]; then
> >>+        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
> >>+    else
> >>+        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
> >>+    fi
> >>+done
> >>
> >>Is it really needed to ping with different message sizes? if yes, we
> >>couldadd this
> >>functionality to tst_ping().
> >Yes, we need to make sure ipsec can handle all kinds of message size. But we
> >could not make it in tst_ping because ah/esp and tunnel/transport have
> >different header length. e.g. when there is no ipsec, the max playload is
> >65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
> >make tst_ping to handle all these scenarios.
> 
> I thought we could add variable length parameters, something like this
> 
> tst_ping p1 ... pN $ICMP_SIZE_ARRAY
> 
> tst_ping()
> {
>     local msg_sizes=${@:N+1}
> 
>     for size in msg_sizes; do
>     ...
> }

I think tst_ping() is a unit test to check the connectivity, we do not need to
add everything inside. Most time we only need to make sure the rhost is
online. Let's make the test case deside what message size they want to test.

How to you think?

Thanks
Hangbin
> 
> 
> Best regards,
> Alexey
> 
> >Thanks
> >Hangbin
> 

> From 99f1c6eadacd6b03180fe08fc36eae3725a57341 Mon Sep 17 00:00:00 2001
> From: Alexey Kodanev <alexey.kodanev@oracle.com>
> Date: Wed, 23 Mar 2016 11:11:29 +0300
> Subject: [PATCH] testcases/lib/test_net.sh: export TST_IPV6 var
> 
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>  testcases/lib/test_net.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
> index 418fed3..1227265 100644
> --- a/testcases/lib/test_net.sh
> +++ b/testcases/lib/test_net.sh
> @@ -154,7 +154,7 @@ tst_read_opts()
>  	while getopts ":6" opt; do
>  		case "$opt" in
>  		6)
> -			TST_IPV6=6;;
> +			export TST_IPV6=6;;
>  		esac
>  	done
>  	OPTIND=0
> -- 
> 1.7.1
> 

> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp


-- 

Thanks & Best Regards
Hangbin Liu <haliu@redhat.com>
Leo on #kernel-qe, #kernel, #eng-china

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-23 13:30         ` Hangbin Liu
@ 2016-03-28 10:09           ` Alexey Kodanev
  2016-03-28 14:33             ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-03-28 10:09 UTC (permalink / raw)
  To: ltp

Hi,
On 03/23/2016 04:30 PM, Hangbin Liu wrote:
> Hi,
> On Wed, Mar 23, 2016 at 11:21:37AM +0300, Alexey Kodanev wrote:
>> Hi,
>>>>> @@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
>>>>>   # The version of IP
>>>>>   IP_VER=${IP_VER:-4}
>>>>> +[ $IP_VER -eq 6 ] && TST_IPV6=6
>>>> just "ipv=${TST_IPV6:-4}" instead of two lines.
>>> This is not work. Because test_net.sh will set TST_IPV6= , and icmp4-uni-basic01
>>> need source it before test. The relation looks like
>>>
>>> icmp6-uni-basic01
>>>    . icmp4-uni-basic01
>>>      . ipsec_lib.sh
>>>        . test_net.sh
>>>
>>> If we want to use like ipv=${TST_IPV6:-4}, we need source test_net.sh in all
>>> sub-testcases instead of in ipsec_lib.sh. Which will like
>>>
>>> icmp6-uni-basic01
>>>    . test_net.sh
>>>    . icmp4-uni-basic01
>>>      . ipsec_lib.sh
>> Could you add "ipv=..." to ipsec_lib.sh and we wouldn't set it in every
>> test-case?
> the IP_VER is to describe what the test run for. We shouldn't add it in
> ipsec_lib.sh. There is no relations between them.

Looking at the tests structure there... basically, one file implements 
test-cases
and the rest scripts source the first one along with changing a few 
parameters.
I think it's better to leave only one file there and remove the rest.

icmp4-uni-basic01 -> icmp-uni-basic.

May be moving them all to the upper directory, so in the end we should 
have only 3 tests:
icmp_multi_diffip.sh
icmp_multi_diffnic.sh
icmp_uni_basic.sh

Then, we could define each test-case in "runtests/", using env vars and 
parameters.

>
>> BTW, does the attached patch help in the first case (added export to
>> TST_IPV6)?
> I'm afraid not. I'd tried to use like
>
> icmp4-uni-basic01 icmp4-uni-basic01
> icmp6-uni-basic01 icmp4-uni-basic01 -6
>
> Then I find this is not only different of IP version, ipsec protocol, mode. But
> also different message sizes. So I give up to use like that.
>
>>
>>>> -# Run a client
>>>> -$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
>>>> -
>>>> -sleep $NS_DURATION
>>>> -killall_icmp_traffic
>>>> -wait
>>>> +# Make sure the connectvity
>>>> +for msg_size in $ICMP_SIZE_ARRAY; do
>>>> +    tst_ping $lhost_ifname $rhost_addr $msg_size
>>>> +    if [ $? -ne 0 ]; then
>>>> +        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
>>>> +    else
>>>> +        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
>>>> +    fi
>>>> +done
>>>>
>>>> Is it really needed to ping with different message sizes? if yes, we
>>>> couldadd this
>>>> functionality to tst_ping().
>>> Yes, we need to make sure ipsec can handle all kinds of message size. But we
>>> could not make it in tst_ping because ah/esp and tunnel/transport have
>>> different header length. e.g. when there is no ipsec, the max playload is
>>> 65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
>>> make tst_ping to handle all these scenarios.
>> I thought we could add variable length parameters, something like this
>>
>> tst_ping p1 ... pN $ICMP_SIZE_ARRAY
>>
>> tst_ping()
>> {
>>      local msg_sizes=${@:N+1}
>>
>>      for size in msg_sizes; do
>>      ...
>> }
> I think tst_ping() is a unit test to check the connectivity, we do not need to
> add everything inside. Most time we only need to make sure the rhost is
> online. Let's make the test case deside what message size they want to test.
>
> How to you think?

I still think we should add it to the library. tst_ping replaces
'icmp4/6_check_connectivity'. And adding variable message size there,
will replace ns-echoclient library tool.

I don't understand why do you want to implement it in the each icmp test?

Thanks,
Alexey


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-28 10:09           ` Alexey Kodanev
@ 2016-03-28 14:33             ` Hangbin Liu
  2016-03-30 12:41               ` Alexey Kodanev
  0 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-03-28 14:33 UTC (permalink / raw)
  To: ltp

Hi Alexey,

On Mon, Mar 28, 2016 at 01:09:02PM +0300, Alexey Kodanev wrote:
> Hi,
> On 03/23/2016 04:30 PM, Hangbin Liu wrote:
> >Hi,
> >On Wed, Mar 23, 2016 at 11:21:37AM +0300, Alexey Kodanev wrote:
> >>Hi,
> >>>>>@@ -72,6 +65,7 @@ LINK_NUM=${LINK_NUM:-0}
> >>>>>  # The version of IP
> >>>>>  IP_VER=${IP_VER:-4}
> >>>>>+[ $IP_VER -eq 6 ] && TST_IPV6=6
> >>>>just "ipv=${TST_IPV6:-4}" instead of two lines.
> >>>This is not work. Because test_net.sh will set TST_IPV6= , and icmp4-uni-basic01
> >>>need source it before test. The relation looks like
> >>>
> >>>icmp6-uni-basic01
> >>>   . icmp4-uni-basic01
> >>>     . ipsec_lib.sh
> >>>       . test_net.sh
> >>>
> >>>If we want to use like ipv=${TST_IPV6:-4}, we need source test_net.sh in all
> >>>sub-testcases instead of in ipsec_lib.sh. Which will like
> >>>
> >>>icmp6-uni-basic01
> >>>   . test_net.sh
> >>>   . icmp4-uni-basic01
> >>>     . ipsec_lib.sh
> >>Could you add "ipv=..." to ipsec_lib.sh and we wouldn't set it in every
> >>test-case?
> >the IP_VER is to describe what the test run for. We shouldn't add it in
> >ipsec_lib.sh. There is no relations between them.
> 
> Looking at the tests structure there... basically, one file implements
> test-cases
> and the rest scripts source the first one along with changing a few
> parameters.
> I think it's better to leave only one file there and remove the rest.
> 
> icmp4-uni-basic01 -> icmp-uni-basic.
> 
> May be moving them all to the upper directory, so in the end we should have
> only 3 tests:
> icmp_multi_diffip.sh
> icmp_multi_diffnic.sh
> icmp_uni_basic.sh
> 
> Then, we could define each test-case in "runtests/", using env vars and
> parameters.

Does it looks like

icmp4-uni-basic01 icmp-uni-basic
icmp4-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65483"; icmp-uni-basic
...
icmp6-uni-basic01 icmp-uni-basic -6
icmp6-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65503"; icmp-uni-basic -6

> 
> >
> >>BTW, does the attached patch help in the first case (added export to
> >>TST_IPV6)?
> >I'm afraid not. I'd tried to use like
> >
> >icmp4-uni-basic01 icmp4-uni-basic01
> >icmp6-uni-basic01 icmp4-uni-basic01 -6
> >
> >Then I find this is not only different of IP version, ipsec protocol, mode. But
> >also different message sizes. So I give up to use like that.
> >
> >>
> >>>>-# Run a client
> >>>>-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
> >>>>-
> >>>>-sleep $NS_DURATION
> >>>>-killall_icmp_traffic
> >>>>-wait
> >>>>+# Make sure the connectvity
> >>>>+for msg_size in $ICMP_SIZE_ARRAY; do
> >>>>+    tst_ping $lhost_ifname $rhost_addr $msg_size
> >>>>+    if [ $? -ne 0 ]; then
> >>>>+        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
> >>>>+    else
> >>>>+        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
> >>>>+    fi
> >>>>+done
> >>>>
> >>>>Is it really needed to ping with different message sizes? if yes, we
> >>>>couldadd this
> >>>>functionality to tst_ping().
> >>>Yes, we need to make sure ipsec can handle all kinds of message size. But we
> >>>could not make it in tst_ping because ah/esp and tunnel/transport have
> >>>different header length. e.g. when there is no ipsec, the max playload is
> >>>65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
> >>>make tst_ping to handle all these scenarios.
> >>I thought we could add variable length parameters, something like this
> >>
> >>tst_ping p1 ... pN $ICMP_SIZE_ARRAY
> >>
> >>tst_ping()
> >>{
> >>     local msg_sizes=${@:N+1}
> >>
> >>     for size in msg_sizes; do
> >>     ...
> >>}
> >I think tst_ping() is a unit test to check the connectivity, we do not need to
> >add everything inside. Most time we only need to make sure the rhost is
> >online. Let's make the test case deside what message size they want to test.
> >
> >How to you think?
> 
> I still think we should add it to the library. tst_ping replaces
> 'icmp4/6_check_connectivity'. And adding variable message size there,
> will replace ns-echoclient library tool.

I did't find icmp4/6_check_connectivity will do icmp msg_size check. But anyway,
here is a msg_sizes version. how do you think? should we use ROD ping... directly?

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)"}
        # ping cmd use 56 as default message size
        local msg_sizes=${3:-"56"}

        for size in $msg_sizes; do
                ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
                        -s $msg_size > /dev/null 2>&1
                if [ $? -ne 0 ]; then
                        tst_brkm TBROK "There is no IPv${IP_VER:-4} connectivity with msg_size $msg_size"
                else
                        tst_resm TPASS "There is IPv${IP_VER:-4} connectivity with msg_size $msg_size"
                fi
        done
}

Thanks & Best Regards
Hangbin Liu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-28 14:33             ` Hangbin Liu
@ 2016-03-30 12:41               ` Alexey Kodanev
  2016-04-06  7:52                 ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-03-30 12:41 UTC (permalink / raw)
  To: ltp

Hi,

On 03/28/2016 05:33 PM, Hangbin Liu wrote:
> Hi Alexey,
>
> On Mon, Mar 28, 2016 at 01:09:02PM +0300, Alexey Kodanev wrote:
>>
>> Looking at the tests structure there... basically, one file implements
>> test-cases
>> and the rest scripts source the first one along with changing a few
>> parameters.
>> I think it's better to leave only one file there and remove the rest.
>>
>> icmp4-uni-basic01 -> icmp-uni-basic.
>>
>> May be moving them all to the upper directory, so in the end we should have
>> only 3 tests:
>> icmp_multi_diffip.sh
>> icmp_multi_diffnic.sh
>> icmp_uni_basic.sh
>>
>> Then, we could define each test-case in "runtests/", using env vars and
>> parameters.
> Does it looks like
>
> icmp4-uni-basic01 icmp-uni-basic
> icmp4-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65483"; icmp-uni-basic
> ...
> icmp6-uni-basic01 icmp-uni-basic -6
> icmp6-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65503"; icmp-uni-basic -6

Or something like network/virt_lib.sh does with getopts, so instead of 
setting
environment variables we would have easy to look at runtest lines, e.g.:

icmp6-uni-basic01 icmp-uni-basic -6
icmp6-uni-basic02 icmp-uni-basic -6 -p ah -m transport -s "10 100 1000 10000 65503"


>
>>>> BTW, does the attached patch help in the first case (added export to
>>>> TST_IPV6)?
>>> I'm afraid not. I'd tried to use like
>>>
>>> icmp4-uni-basic01 icmp4-uni-basic01
>>> icmp6-uni-basic01 icmp4-uni-basic01 -6
>>>
>>> Then I find this is not only different of IP version, ipsec protocol, mode. But
>>> also different message sizes. So I give up to use like that.
>>>
>>>>>> -# Run a client
>>>>>> -$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-echoclient -S $lhost_addr -f $IP_VER -s \"$ICMP_SIZE_ARRAY\"" &
>>>>>> -
>>>>>> -sleep $NS_DURATION
>>>>>> -killall_icmp_traffic
>>>>>> -wait
>>>>>> +# Make sure the connectvity
>>>>>> +for msg_size in $ICMP_SIZE_ARRAY; do
>>>>>> +    tst_ping $lhost_ifname $rhost_addr $msg_size
>>>>>> +    if [ $? -ne 0 ]; then
>>>>>> +        tst_brkm TBROK "There is no IPv$IP_VER connectivity with msg_size $msg_size"
>>>>>> +    else
>>>>>> +        tst_resm TPASS "There has IPv$IP_VER connectivity with msg_size $msg_size"
>>>>>> +    fi
>>>>>> +done
>>>>>>
>>>>>> Is it really needed to ping with different message sizes? if yes, we
>>>>>> couldadd this
>>>>>> functionality to tst_ping().
>>>>> Yes, we need to make sure ipsec can handle all kinds of message size. But we
>>>>> could not make it in tst_ping because ah/esp and tunnel/transport have
>>>>> different header length. e.g. when there is no ipsec, the max playload is
>>>>> 65507. If we test ah + transport, the max playload is 65483. etc. It's hard to
>>>>> make tst_ping to handle all these scenarios.
>>>> I thought we could add variable length parameters, something like this
>>>>
>>>> tst_ping p1 ... pN $ICMP_SIZE_ARRAY
>>>>
>>>> tst_ping()
>>>> {
>>>>      local msg_sizes=${@:N+1}
>>>>
>>>>      for size in msg_sizes; do
>>>>      ...
>>>> }
>>> I think tst_ping() is a unit test to check the connectivity, we do not need to
>>> add everything inside. Most time we only need to make sure the rhost is
>>> online. Let's make the test case deside what message size they want to test.
>>>
>>> How to you think?
>> I still think we should add it to the library. tst_ping replaces
>> 'icmp4/6_check_connectivity'. And adding variable message size there,
>> will replace ns-echoclient library tool.
> I did't find icmp4/6_check_connectivity will do icmp msg_size check. But anyway,
> here is a msg_sizes version. how do you think? should we use ROD ping... directly?

It's in "ns-echoclient".

About ROD in tst_ping()... may be we shouldn't use it here. It's quite 
simple
to call "ROD tst_ping" anyway.

Also I'm not sure we won't have tests that pass on failed ping. For example,
vxlan tests set different IDs and check that there is no connectivity. 
In this particular cases,
the test shouldn't exit with TBROK but return TPASS status. We could 
simply return ping
status here and let test to decide what to do next.


>
> 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)"}
>          # ping cmd use 56 as default message size
>          local msg_sizes=${3:-"56"}

local msg_sizes=${@:3}

for size in ${msg_sizes:-"56"}; do
     ping...


Best regards,
Alexey

>
>          for size in $msg_sizes; do
>                  ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
>                          -s $msg_size > /dev/null 2>&1
>                  if [ $? -ne 0 ]; then
>                          tst_brkm TBROK "There is no IPv${IP_VER:-4} connectivity with msg_size $msg_size"
>                  else
>                          tst_resm TPASS "There is IPv${IP_VER:-4} connectivity with msg_size $msg_size"
>                  fi
>          done
> }
>
> Thanks & Best Regards
> Hangbin Liu


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-03-30 12:41               ` Alexey Kodanev
@ 2016-04-06  7:52                 ` Hangbin Liu
  2016-04-06  9:49                   ` Alexey Kodanev
  0 siblings, 1 reply; 16+ messages in thread
From: Hangbin Liu @ 2016-04-06  7:52 UTC (permalink / raw)
  To: ltp

Hi,
On Wed, Mar 30, 2016 at 03:41:36PM +0300, Alexey Kodanev wrote:
> >Does it looks like
> >
> >icmp4-uni-basic01 icmp-uni-basic
> >icmp4-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65483"; icmp-uni-basic
> >...
> >icmp6-uni-basic01 icmp-uni-basic -6
> >icmp6-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65503"; icmp-uni-basic -6
> 
> Or something like network/virt_lib.sh does with getopts, so instead of
> setting
> environment variables we would have easy to look at runtest lines, e.g.:
> 
> icmp6-uni-basic01 icmp-uni-basic -6
> icmp6-uni-basic02 icmp-uni-basic -6 -p ah -m transport -s "10 100 1000 10000 65503"

OK, I will try this way

> >>I still think we should add it to the library. tst_ping replaces
> >>'icmp4/6_check_connectivity'. And adding variable message size there,
> >>will replace ns-echoclient library tool.
> >I did't find icmp4/6_check_connectivity will do icmp msg_size check. But anyway,
> >here is a msg_sizes version. how do you think? should we use ROD ping... directly?
> 
> It's in "ns-echoclient".

ns-echoclient only ping remote but do not check the return status.

> 
> About ROD in tst_ping()... may be we shouldn't use it here. It's quite
> simple
> to call "ROD tst_ping" anyway.
> 
> Also I'm not sure we won't have tests that pass on failed ping. For example,
> vxlan tests set different IDs and check that there is no connectivity. In
> this particular cases,
> the test shouldn't exit with TBROK but return TPASS status. We could simply
> return ping
> status here and let test to decide what to do next.

Here comes back the old discuss. tst_ping is used for check connectivity. If
we use msg_sizes="10 100 1000 10000 65530" and failed when send msg_size
10000 and return -1. How the test know which msg size failed? That's the
reason I feel we should let tst_ping check one msg_size each time.

Thanks
Hangbin

> 
> >
> >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)"}
> >         # ping cmd use 56 as default message size
> >         local msg_sizes=${3:-"56"}
> 
> local msg_sizes=${@:3}
> 
> for size in ${msg_sizes:-"56"}; do
>     ping...
> 
> 
> Best regards,
> Alexey
> 
> >
> >         for size in $msg_sizes; do
> >                 ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
> >                         -s $msg_size > /dev/null 2>&1
> >                 if [ $? -ne 0 ]; then
> >                         tst_brkm TBROK "There is no IPv${IP_VER:-4} connectivity with msg_size $msg_size"
> >                 else
> >                         tst_resm TPASS "There is IPv${IP_VER:-4} connectivity with msg_size $msg_size"
> >                 fi
> >         done
> >}
> >
> >Thanks & Best Regards
> >Hangbin Liu
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 

Thanks & Best Regards
Hangbin Liu <haliu@redhat.com>
Leo on #kernel-qe, #kernel, #eng-china

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-04-06  7:52                 ` Hangbin Liu
@ 2016-04-06  9:49                   ` Alexey Kodanev
  2016-04-06 12:58                     ` Hangbin Liu
  0 siblings, 1 reply; 16+ messages in thread
From: Alexey Kodanev @ 2016-04-06  9:49 UTC (permalink / raw)
  To: ltp

Hi,

On 04/06/2016 10:52 AM, Hangbin Liu wrote:
> Hi,
> On Wed, Mar 30, 2016 at 03:41:36PM +0300, Alexey Kodanev wrote:
>>> Does it looks like
>>>
>>> icmp4-uni-basic01 icmp-uni-basic
>>> icmp4-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65483"; icmp-uni-basic
>>> ...
>>> icmp6-uni-basic01 icmp-uni-basic -6
>>> icmp6-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65503"; icmp-uni-basic -6
>> Or something like network/virt_lib.sh does with getopts, so instead of
>> setting
>> environment variables we would have easy to look at runtest lines, e.g.:
>>
>> icmp6-uni-basic01 icmp-uni-basic -6
>> icmp6-uni-basic02 icmp-uni-basic -6 -p ah -m transport -s "10 100 1000 10000 65503"
> OK, I will try this way
>
>>>> I still think we should add it to the library. tst_ping replaces
>>>> 'icmp4/6_check_connectivity'. And adding variable message size there,
>>>> will replace ns-echoclient library tool.
>>> I did't find icmp4/6_check_connectivity will do icmp msg_size check. But anyway,
>>> here is a msg_sizes version. how do you think? should we use ROD ping... directly?
>> It's in "ns-echoclient".
> ns-echoclient only ping remote but do not check the return status.

Yeah, I know, that's the reason you removed it in your patch.

>
>> About ROD in tst_ping()... may be we shouldn't use it here. It's quite
>> simple
>> to call "ROD tst_ping" anyway.
>>
>> Also I'm not sure we won't have tests that pass on failed ping. For example,
>> vxlan tests set different IDs and check that there is no connectivity. In
>> this particular cases,
>> the test shouldn't exit with TBROK but return TPASS status. We could simply
>> return ping
>> status here and let test to decide what to do next.
> Here comes back the old discuss. tst_ping is used for check connectivity. If
> we use msg_sizes="10 100 1000 10000 65530" and failed when send msg_size
> 10000 and return -1. How the test know which msg size failed? That's the
> reason I feel we should let tst_ping check one msg_size each time.

We could print it in tst_ping() as information message before 'return 1',
will it be enough?


Thanks,
Alexey

> Thanks
> Hangbin
>
>>> 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)"}
>>>          # ping cmd use 56 as default message size
>>>          local msg_sizes=${3:-"56"}
>> local msg_sizes=${@:3}
>>
>> for size in ${msg_sizes:-"56"}; do
>>      ping...
>>
>>
>> Best regards,
>> Alexey
>>
>>>          for size in $msg_sizes; do
>>>                  ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
>>>                          -s $msg_size > /dev/null 2>&1
>>>                  if [ $? -ne 0 ]; then
>>>                          tst_brkm TBROK "There is no IPv${IP_VER:-4} connectivity with msg_size $msg_size"
>>>                  else
>>>                          tst_resm TPASS "There is IPv${IP_VER:-4} connectivity with msg_size $msg_size"
>>>                  fi
>>>          done
>>> }
>>>
>>> Thanks & Best Regards
>>> Hangbin Liu
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing
  2016-04-06  9:49                   ` Alexey Kodanev
@ 2016-04-06 12:58                     ` Hangbin Liu
  0 siblings, 0 replies; 16+ messages in thread
From: Hangbin Liu @ 2016-04-06 12:58 UTC (permalink / raw)
  To: ltp

On Wed, Apr 06, 2016 at 12:49:50PM +0300, Alexey Kodanev wrote:
> Hi,
> 
> On 04/06/2016 10:52 AM, Hangbin Liu wrote:
> >Hi,
> >On Wed, Mar 30, 2016 at 03:41:36PM +0300, Alexey Kodanev wrote:
> >>>Does it looks like
> >>>
> >>>icmp4-uni-basic01 icmp-uni-basic
> >>>icmp4-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65483"; icmp-uni-basic
> >>>...
> >>>icmp6-uni-basic01 icmp-uni-basic -6
> >>>icmp6-uni-basic02 DO_IPSEC=true IPSEC_PROTO=ah IPSEC_MODE=transport ICMP_SIZE_ARRAY="10 100 1000 10000 65503"; icmp-uni-basic -6
> >>Or something like network/virt_lib.sh does with getopts, so instead of
> >>setting
> >>environment variables we would have easy to look at runtest lines, e.g.:
> >>
> >>icmp6-uni-basic01 icmp-uni-basic -6
> >>icmp6-uni-basic02 icmp-uni-basic -6 -p ah -m transport -s "10 100 1000 10000 65503"
> >OK, I will try this way
> >
> >>>>I still think we should add it to the library. tst_ping replaces
> >>>>'icmp4/6_check_connectivity'. And adding variable message size there,
> >>>>will replace ns-echoclient library tool.
> >>>I did't find icmp4/6_check_connectivity will do icmp msg_size check. But anyway,
> >>>here is a msg_sizes version. how do you think? should we use ROD ping... directly?
> >>It's in "ns-echoclient".
> >ns-echoclient only ping remote but do not check the return status.
> 
> Yeah, I know, that's the reason you removed it in your patch.
> 
> >
> >>About ROD in tst_ping()... may be we shouldn't use it here. It's quite
> >>simple
> >>to call "ROD tst_ping" anyway.
> >>
> >>Also I'm not sure we won't have tests that pass on failed ping. For example,
> >>vxlan tests set different IDs and check that there is no connectivity. In
> >>this particular cases,
> >>the test shouldn't exit with TBROK but return TPASS status. We could simply
> >>return ping
> >>status here and let test to decide what to do next.
> >Here comes back the old discuss. tst_ping is used for check connectivity. If
> >we use msg_sizes="10 100 1000 10000 65530" and failed when send msg_size
> >10000 and return -1. How the test know which msg size failed? That's the
> >reason I feel we should let tst_ping check one msg_size each time.
> 
> We could print it in tst_ping() as information message before 'return 1',
> will it be enough?

Yes, that would be fine. Thanks for the advice.

Regards
Hangbin
> 
> 
> Thanks,
> Alexey
> 
> >Thanks
> >Hangbin
> >
> >>>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)"}
> >>>         # ping cmd use 56 as default message size
> >>>         local msg_sizes=${3:-"56"}
> >>local msg_sizes=${@:3}
> >>
> >>for size in ${msg_sizes:-"56"}; do
> >>     ping...
> >>
> >>
> >>Best regards,
> >>Alexey
> >>
> >>>         for size in $msg_sizes; do
> >>>                 ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
> >>>                         -s $msg_size > /dev/null 2>&1
> >>>                 if [ $? -ne 0 ]; then
> >>>                         tst_brkm TBROK "There is no IPv${IP_VER:-4} connectivity with msg_size $msg_size"
> >>>                 else
> >>>                         tst_resm TPASS "There is IPv${IP_VER:-4} connectivity with msg_size $msg_size"
> >>>                 fi
> >>>         done
> >>>}
> >>>
> >>>Thanks & Best Regards
> >>>Hangbin Liu
> >>
> >>-- 
> >>Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 

Thanks & Best Regards
Hangbin Liu <haliu@redhat.com>
Leo on #kernel-qe, #kernel, #eng-china

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-04-06 12:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-17 10:04 [LTP] [PATCHv3 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
2016-03-17 10:04 ` [LTP] [PATCHv3 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
2016-03-17 10:04 ` [LTP] [PATCHv3 2/3] network/stress: add ipsec lib Hangbin Liu
2016-03-22 12:51   ` Alexey Kodanev
2016-03-22 13:36     ` Hangbin Liu
2016-03-17 10:04 ` [LTP] [PATCHv3 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing Hangbin Liu
2016-03-22 13:34   ` Alexey Kodanev
2016-03-23  2:02     ` Hangbin Liu
2016-03-23  8:21       ` Alexey Kodanev
2016-03-23 13:30         ` Hangbin Liu
2016-03-28 10:09           ` Alexey Kodanev
2016-03-28 14:33             ` Hangbin Liu
2016-03-30 12:41               ` Alexey Kodanev
2016-04-06  7:52                 ` Hangbin Liu
2016-04-06  9:49                   ` Alexey Kodanev
2016-04-06 12:58                     ` Hangbin Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.