diff options
author | Jake McGinty <me@jake.su> | 2018-05-08 20:54:20 -0700 |
---|---|---|
committer | Jake McGinty <me@jake.su> | 2018-05-08 20:54:20 -0700 |
commit | fd4b855f34f9780aa0348c226a584fdc428f524d (patch) | |
tree | 40aba3ec3cb49bede56590432a6b920e046dec46 | |
parent | tests: add beginning of timers test. (diff) | |
download | wireguard-rs-fd4b855f34f9780aa0348c226a584fdc428f524d.tar.xz wireguard-rs-fd4b855f34f9780aa0348c226a584fdc428f524d.zip |
tests: more strict verification of packets in sanity-check test
-rwxr-xr-x | tests/timers.sh | 12 |
1 files changed, 8 insertions, 4 deletions
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!" |