From fd4b855f34f9780aa0348c226a584fdc428f524d Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Tue, 8 May 2018 20:54:20 -0700 Subject: tests: more strict verification of packets in sanity-check test --- tests/timers.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/timers.sh b/tests/timers.sh index 98615f0..eab4f4e 100755 --- a/tests/timers.sh +++ b/tests/timers.sh @@ -164,15 +164,19 @@ n1 ping -c 10 -f -W 1 192.168.241.2 sleep 1 -packets2to1=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.20000 > " | wc -l) -packets1to2=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.10000 > " | wc -l) -[[ $packets2to1 -eq 21 && $packets1to2 -eq 21 ]] +tcpdump -r $pcap 2>/dev/null | grep "localhost.20000 > localhost.10000: UDP, length 148" > /dev/null # init handshake +tcpdump -r $pcap 2>/dev/null | grep "localhost.10000 > localhost.20000: UDP, length 92" > /dev/null # resp handshake +pings2to1=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.20000 > localhost.10000: UDP, length 128" | wc -l) +pings1to2=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.10000 > localhost.20000: UDP, length 128" | wc -l) +[[ $pings2to1 -eq 20 && $pings1to2 -eq 20 ]] section "sleeping 10 seconds for passive keepalive..." sleep 10 packets2to1=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.20000 > " | wc -l) packets1to2=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.10000 > " | wc -l) -[[ $packets2to1 -eq 21 && $packets1to2 -eq 22 ]] +keepalives=$(tcpdump -r $pcap 2>/dev/null | grep "UDP, length 32" | wc -l) +keepalives1to2=$(tcpdump -r $pcap 2>/dev/null | grep "localhost.10000 > localhost.20000: UDP, length 32" | wc -l) +[[ $packets2to1 -eq 21 && $packets1to2 -eq 22 && $keepalives -eq 1 && $keepalives1to2 -eq 1]] section "ALL TESTS PASSED!" -- cgit v1.2.3-59-g8ed1b