From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCHv2 2/3] network/stress: add ipsec lib
Date: Wed, 16 Mar 2016 11:27:25 +0300 [thread overview]
Message-ID: <56E918ED.7040709@oracle.com> (raw)
In-Reply-To: <1458035439-9143-3-git-send-email-haliu@redhat.com>
On 03/15/2016 12:50 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 | 126 ++++++++++++++++++++++++++++
> 2 files changed, 155 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
Could be just "...program; If not, see <http://www.gnu.org/licenses/>."
> +#
> +# 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..94b7a43
> --- /dev/null
> +++ b/testcases/network/stress/ipsec/ipsec_lib.sh
> @@ -0,0 +1,126 @@
> +#!/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>
> +#
> +#######################################################################
> +
> +. test_net.sh
> +
> +# c2x: convert charactor to hex
> +c2x()
> +{
> + for str in $@; do
> + for (( i=0; i<${#str}; i++ )); do
> + printf '%x' "'${str:$i:1}"
Again, C-style 'for' not supported by dash. Please change according to
the previous comments.
> + done
> + done
> +}
> +
> +# tst_ipsec flush: flush the ipsec state and policy
> +# tst_ipsec target protocol mode first_spi src_addr dst_addr: config ipsec
> +#
> +# target: target of the configuration file ( src / dst )
> +# protocol: ah / esp / ipcomp
> +# mode: transport / tunnel
> +# first_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
> + first_spi=$4
> + src_ipaddr=$5
> + dst_ipaddr=$6
> +
> + # Encryption algorithm
> + EALGO="des3_ede"
> + EALGO_KEY="0x$(c2x _I_want_to_have_chicken_)"
> +
> + # Authentication algorithm
> + AALGO="sha1"
> + AALGO_KEY="0x$(c2x beef_fish_pork_salad)"
> +
> + # Compression algorithm
> + CALGO="deflate"
> + # Algorithm options for each protocol
> + case $protocol in
> + ah)
Please don't use indent for 'ah)' and in all other cases.
Thanks,
Alexey
next prev parent reply other threads:[~2016-03-16 8:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 9:50 [LTP] [PATCHv2 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
2016-03-15 9:50 ` [LTP] [PATCHv2 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
2016-03-15 12:00 ` Alexey Kodanev
2016-03-15 12:41 ` Hangbin Liu
2016-03-16 8:16 ` Alexey Kodanev
2016-03-15 9:50 ` [LTP] [PATCHv2 2/3] network/stress: add ipsec lib Hangbin Liu
2016-03-16 8:27 ` Alexey Kodanev [this message]
2016-03-15 9:50 ` [LTP] [PATCHv2 3/3] network/stress/icmp: use ip xfrm for icmp4-uni-basic01 ipsec testing Hangbin Liu
2016-03-16 8:36 ` Alexey Kodanev
2016-03-16 14:10 ` Hangbin Liu
2016-03-17 8:43 ` Alexey Kodanev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E918ED.7040709@oracle.com \
--to=alexey.kodanev@oracle.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox