xref: /dpdk/examples/ipsec-secgw/test/data_rxtx.sh (revision 1dc48bce518de1d8cb73f961404a47311c4a248d)
1#! /bin/bash
2# SPDX-License-Identifier: BSD-3-Clause
3
4TCP_PORT=22222
5
6ping_test1()
7{
8	dst=$1
9	i=${2:-0}
10	end=${3:-1200}
11
12	st=0
13	while [[ $i -ne $end && $st -eq 0 ]];
14	do
15		ping -c 1 -s ${i} -M dont ${dst}
16		st=$?
17		let i++
18	done
19
20	if [[ $st -ne 0 ]]; then
21		echo "ERROR: $0 failed for dst=${dst}, sz=${i}"
22	fi
23	return $st;
24}
25
26ping6_test1()
27{
28	dst=$1
29	i=${2:-0}
30	end=${3:-1200}
31
32	st=0
33	while [[ $i -ne $end && $st -eq 0 ]];
34	do
35		ping6 -c 1 -s ${i} -M dont ${dst}
36		st=$?
37		let i++
38	done
39
40	if [[ $st -ne 0 ]]; then
41		echo "ERROR: $0 failed for dst=${dst}, sz=${i}"
42	fi
43	return $st;
44}
45
46scp_test1()
47{
48	dst=$1
49
50	for sz in 1234 23456 345678 4567890 56789102 ; do
51		x=`basename $0`.${sz}
52		dd if=/dev/urandom of=${x} bs=${sz} count=1
53		scp ${x} [${dst}]:${x}
54		scp [${dst}]:${x} ${x}.copy1
55		diff -u ${x} ${x}.copy1
56		st=$?
57		rm -f ${x} ${x}.copy1
58		ssh ${REMOTE_HOST} rm -f ${x}
59		if [[ $st -ne 0 ]]; then
60			return $st
61		fi
62	done
63
64	return 0;
65}
66