3 # $Id: test-step.sh,v 1.1.1.1 2000/05/25 00:28:49 route Exp $
6 # Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com>
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # Hard coded defaults (ie: user hits enter at prompts)
41 echo "Libnet test code step through dealy"
43 echo "This script will run you through all the testcode modules and verify
44 echo "functionality \(hopefully\). You may want to use tcpdump in conjuction
45 echo "with this script to make sure things are working as they should be."
47 echo "Although this script is here to quickly take you through the testcode"
48 echo "modules and confirm correct operation, the user is encouraged to descend"
49 echo "into the test directories and peruse the code for examples on how to use"
50 echo "the library effectively."
52 echo "I will need some information from you for some of these tests."
53 echo "We don't check for sane input here, so don't be an idiot."
60 echo -n "Most of the test modules require a source IP address `echo \($SRC_IP\)`: "
62 if test "$__tmp" != ""; then
66 echo -n "And most of the test modules also require a destination IP address `echo \($DST_IP\)`: "
68 if test "$__tmp" != ""; then
72 echo -n "The TCP and UDP tests need a source port `echo \($SRC_PRT\)`: "
74 if test "$__tmp" != ""; then
78 echo -n "And a destination port `echo \($DST_PRT\)`: "
80 if test "$__tmp" != ""; then
84 echo -n "Some need a link-layer device `echo \($DEV\)`: "
86 if test "$__tmp" != ""; then
90 echo -n "The ethernet tests need a source ethernet address (x:x:x:x:x:x):"
92 if test "$__tmp" != ""; then
96 echo -n "And a destination ethernet address (x:x:x:x:x:x):"
98 if test "$__tmp" != ""; then
102 echo "Gotit! The game can start now."
105 # Internal win/loss variable setup.
116 echo "TCP test suite"
119 echo "./tcp -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
120 ./tcp -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
121 if [ $? -eq -0 ]; then
124 LOSE=`expr $LOSE + 1`
129 if test -x tcp+data; then
130 echo "./tcp+data -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
131 ./tcp+data -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
132 if [ $? -eq -0 ]; then
135 LOSE=`expr $LOSE + 1`
140 if test -x tcp+data+ipopt; then
141 echo "./tcp+data+ipopt -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
142 ./tcp+data+ipopt -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
143 if [ $? -eq -0 ]; then
146 LOSE=`expr $LOSE + 1`
152 echo "completed TCP test suite $WIN test(s) succeeded, $LOSE test(s) failed"
153 TOTAL_WON=`expr $TOTAL_WON + $WIN`
154 TOTAL_LOST=`expr $TOTAL_LOST + $LOSE`
162 echo "UDP test suite"
165 echo "./udp -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
166 ./udp -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
167 if [ $? -eq -0 ]; then
170 LOSE=`expr $LOSE + 1`
175 if test -x udp+data; then
176 echo "./udp+data -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
177 ./udp+data -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
178 if [ $? -eq -0 ]; then
181 LOSE=`expr $LOSE + 1`
187 echo "completed UDP test suite $WIN test(s) succeeded, $LOSE test(s) failed"
188 TOTAL_WON=`expr $TOTAL_WON + $WIN`
189 TOTAL_LOST=`expr $TOTAL_LOST + $LOSE`
197 echo "ICMP test suite"
199 if test -x icmp_echo; then
200 echo "./icmp_echo -s $SRC_IP -d $DST_IP"
201 ./icmp_echo -s $SRC_IP -d $DST_IP
202 if [ $? -eq -0 ]; then
205 LOSE=`expr $LOSE + 1`
210 if test -x icmp_timestamp; then
211 echo "./icmp_timestamp -s $SRC_IP -d $DST_IP"
212 ./icmp_timestamp -s $SRC_IP -d $DST_IP
213 if [ $? -eq -0 ]; then
216 LOSE=`expr $LOSE + 1`
221 if test -x icmp_timexceed; then
222 echo "./icmp_timexceed -s $SRC_IP -d $DST_IP"
223 ./icmp_timexceed -s $SRC_IP -d $DST_IP
224 if [ $? -eq -0 ]; then
227 LOSE=`expr $LOSE + 1`
232 if test -x icmp_unreach; then
233 echo "./icmp_unreach -s $SRC_IP -d $DST_IP"
234 ./icmp_unreach -s $SRC_IP -d $DST_IP
235 if [ $? -eq -0 ]; then
238 LOSE=`expr $LOSE + 1`
243 if test -x silvertongue; then
244 echo "./silvertongue $SRC_IP 200.200.200.200 $DST_IP"
245 ./silvertongue $SRC_IP 200.200.200.200 $DST_IP
246 if [ $? -eq -0 ]; then
249 LOSE=`expr $LOSE + 1`
255 echo "completed ICMP test suite $WIN test(s) succeeded, $LOSE test(s) failed"
256 TOTAL_WON=`expr $TOTAL_WON + $WIN`
257 TOTAL_LOST=`expr $TOTAL_LOST + $LOSE`
265 echo "Ethernet test suite"
267 if test -x icmp_mask; then
268 echo "./icmp_mask -i $DEV -s $SRC_IP -d $DST_IP"
269 ./icmp_mask -i $DEV -s $SRC_IP -d $DST_IP
270 if [ $? -eq -0 ]; then
273 LOSE=`expr $LOSE + 1`
281 if [ $? -eq -0 ]; then
284 LOSE=`expr $LOSE + 1`
290 echo "./tcp -i $DEV -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT"
291 ./tcp -i $DEV -s $SRC_IP.$SRC_PRT -d $DST_IP.$DST_PRT
292 if [ $? -eq -0 ]; then
295 LOSE=`expr $LOSE + 1`
301 echo "completed Ethernet test suite $WIN test(s) succeeded, $LOSE test(s) failed"
302 TOTAL_WON=`expr $TOTAL_WON + $WIN`
303 TOTAL_LOST=`expr $TOTAL_LOST + $LOSE`
311 echo "completed entire test suite $TOTAL_WON test(s) succeeded, $TOTAL_LOST test(s) failed"