diff --git a/tests/p_tcpdump/tcp6dump_lo.sh b/tests/p_tcpdump/tcp6dump_lo.sh new file mode 100755 index 0000000..5b1c2c8 --- /dev/null +++ b/tests/p_tcpdump/tcp6dump_lo.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - TCPdump test IPv6 to lo" + +# Grabing IPv6 address of lo to checl if IPv6 is enabled +IP=$(ip addr list lo | grep 'inet6 ') +regex='\t*inet6\ (.*)\/.*' +if [[ $IP =~ $regex ]] + then + t_Log "IPv6 seems to be enabled - runing test" + FILE='/var/tmp/lo_test6.pcap' + #Dumping 4 ping6s to loopback to file + tcpdump -q -n -p -i lo -w $FILE & + # If we don't wait a short time, the first paket will be missed by tcpdump + sleep 1 + ping6 -q -c 4 -i 0.25 ::1 + sleep 1 + killall -s SIGINT tcpdump + + # reading from file, for each ping we should see two pakets + WORKING=$( tcpdump -r $FILE | grep -ci icmp6 ) + if [ $WORKING == 8 ]; then + ret_val=0 + else + ret_val=1 + fi + # Remove file afterwards + /bin/rm $FILE +else + t_Log "IPv6 seems to be disabled - skipping test" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_tcpdump/tcpdump_lo.sh b/tests/p_tcpdump/tcpdump_lo.sh new file mode 100755 index 0000000..4318473 --- /dev/null +++ b/tests/p_tcpdump/tcpdump_lo.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - TCPdump test to lo" + +#Dumping 4 pings to loopback to file +FILE='/var/tmp/lo_test.pcap' + +tcpdump -q -n -p -i lo -w $FILE & +# If we don't wait a short time, the first paket will be missed by tcpdump +sleep 1 +ping -q -c 4 -i 0.25 127.0.0.1 +sleep 1 +killall -s SIGINT tcpdump + +# reading from file, for each ping we should see two pakets +WORKING=$( tcpdump -r $FILE | grep -ci icmp ) +if [ $WORKING == 8 ] + then + ret_val=0 +else + ret_val=1 +fi + +# Remove file afterwards +/bin/rm $FILE + +t_CheckExitStatus $ret_val diff --git a/tests/p_tcpdump/tcpdump_test.sh b/tests/p_tcpdump/tcpdump_test.sh deleted file mode 100755 index 4bc279e..0000000 --- a/tests/p_tcpdump/tcpdump_test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# Author: Christoph Galuschka -# Athmane Madjoudj - -t_Log "Running $0 - TCPdump test" - -#Dumping 4 pings to loopback to file -tcpdump -q -n -p -i lo -w /var/tmp/centos_test.pcap & -# If we don't wait a short time, the first paket will be missed by tcpdump -sleep 1 -ping -q -c 4 -i 0.25 127.0.0.1 -killall -s SIGINT tcpdump -sleep 1 - -# reading from file, for each ping we should see two pakets -WORKING=$( tcpdump -r /var/tmp/centos_test.pcap | grep -ci icmp ) -if [ $WORKING == 8 ]; then ret_val=0; fi - -# Remove file afterwards -# /bin/rm /var/tmp/centos_test.pcap - -t_CheckExitStatus $ret_val