Blame tests/p_tcpdump/tcpdump_test.sh

Christoph Galuschka c16101
#!/bin/sh
Christoph Galuschka c16101
# Author: Christoph Galuschka <christoph.galuschka@tiwag.at>
Athmane Madjoudj 859bbc
#         Athmane Madjoudj <athmanem@gmail.com>
Christoph Galuschka c16101
Christoph Galuschka c16101
t_Log "Running $0 - TCPdump test"
Christoph Galuschka c16101
Christoph Galuschka c16101
#Dumping 4 pings to loopback to file
Athmane Madjoudj 859bbc
tcpdump -q -n -p -i lo -w /var/tmp/centos_test.pcap &
Christoph Galuschka c16101
# If we don't wait a short time, the first paket will be missed by tcpdump
Christoph Galuschka c16101
sleep 1
Athmane Madjoudj 859bbc
ping -q -c 4 -i 0.25 127.0.0.1
Athmane Madjoudj ec845b
killall -s SIGINT tcpdump
Athmane Madjoudj ec845b
sleep 1
Christoph Galuschka c16101
Christoph Galuschka c16101
# reading from file, for each ping we should see two pakets
Athmane Madjoudj ec845b
WORKING=$( tcpdump -r /var/tmp/centos_test.pcap | grep -ci icmp )
Christoph Galuschka c16101
if [ $WORKING == 8 ]; then ret_val=0; fi
Christoph Galuschka c16101
Christoph Galuschka c16101
# Remove file afterwards
Athmane Madjoudj ec845b
# /bin/rm /var/tmp/centos_test.pcap
Christoph Galuschka c16101
Athmane Madjoudj 7f72f6
t_CheckExitStatus $ret_val