From: Hangbin Liu <haliu@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v8 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity
Date: Wed, 27 Apr 2016 20:54:34 +0800 [thread overview]
Message-ID: <1461761676-28599-2-git-send-email-haliu@redhat.com> (raw)
In-Reply-To: <1461761676-28599-1-git-send-email-haliu@redhat.com>
Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
testcases/lib/test_net.sh | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 418fed3..f391302 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -314,3 +314,33 @@ tst_netload()
return $ret
}
+
+# tst_ping [IFACE] [DST ADDR] [MESSAGE SIZE ARRAY]
+# Check icmp connectivity
+# IFACE: source interface name
+# DST ADDR: destination IPv4 or IPv6 address
+# MESSAGE SIZE ARRAY: message size array
+tst_ping()
+{
+ # The max number of ICMP echo request
+ PING_MAX=${PING_MAX:-"10"}
+
+ local src_iface=${1:-"$(tst_iface)"}
+ local dst_addr=${2:-"$(tst_ipaddr rhost)"}; shift 2
+ local msg_sizes=$@
+ local ret=0
+
+ # ping cmd use 56 as default message size
+ for size in ${msg_sizes:-"56"}; do
+ ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
+ -s $size > /dev/null 2>&1
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size pass"
+ else
+ tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size fail"
+ break
+ fi
+ done
+ return $ret
+}
--
2.5.5
next prev parent reply other threads:[~2016-04-27 12:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 12:54 [LTP] [PATCH v8 0/3] networking/stress/icmp: add ip xfrm ipsec support Hangbin Liu
2016-04-27 12:54 ` Hangbin Liu [this message]
2016-04-27 12:54 ` [LTP] [PATCH v8 2/3] network/stress: add ipsec lib Hangbin Liu
2016-04-27 12:54 ` [LTP] [PATCH v8 3/3] network/stress/icmp: add icmp-uni-basic to implement all icmp basic stress test Hangbin Liu
2016-04-28 13:51 ` [LTP] [PATCH v8 0/3] networking/stress/icmp: add ip xfrm ipsec support Alexey Kodanev
2016-04-29 2:05 ` Hangbin Liu
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=1461761676-28599-2-git-send-email-haliu@redhat.com \
--to=haliu@redhat.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