Blame tests/p_tcpdump/tcpdump_test.sh
|
Christoph Galuschka |
c16101 |
#!/bin/sh
|
|
Christoph Galuschka |
c16101 |
# Author: Christoph Galuschka <christoph.galuschka@tiwag.at>
|
|
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
|
|
Christoph Galuschka |
c16101 |
tcpdump -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
|
|
Christoph Galuschka |
c16101 |
ping -c 4 -i 0.25 127.0.0.1
|
|
Christoph Galuschka |
c16101 |
killall tcpdump
|
|
Christoph Galuschka |
c16101 |
|
|
Christoph Galuschka |
c16101 |
# reading from file, for each ping we should see two pakets
|
|
Christoph Galuschka |
c16101 |
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
|
|
Christoph Galuschka |
c16101 |
/bin/rm /var/tmp/centos_test.pcap
|
|
Christoph Galuschka |
c16101 |
|
|
Christoph Galuschka |
c16101 |
t_CheckExitStatus $?
|