aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake McGinty <me@jake.su>2018-05-08 22:02:25 -0700
committerJake McGinty <me@jake.su>2018-05-08 22:02:25 -0700
commit0a3e026201aa79fbfdd4423d25589bfa67ed698e (patch)
treecdb749611e44f9f31eef1f60c9a2380c160389b6
parentpeer_server: fix timer bugs caught by tests! (diff)
downloadwireguard-rs-0a3e026201aa79fbfdd4423d25589bfa67ed698e.tar.xz
wireguard-rs-0a3e026201aa79fbfdd4423d25589bfa67ed698e.zip
tests: add basic persistent keepalive timer test
-rwxr-xr-xtests/timers.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/timers.sh b/tests/timers.sh
index 28138e5..3922f93 100755
--- a/tests/timers.sh
+++ b/tests/timers.sh
@@ -190,4 +190,17 @@ 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 ]]
+section "testing immediate send of persistent keepalive when set"
+n1 wg set wg1 peer "$pub2" persistent-keepalive 5
+sleep 1
+keepalives=$(tcpdump -r $pcap 2>/dev/null | grep "UDP, length 32" | wc -l)
+echo "keepalives $keepalives"
+[[ $keepalives -eq 2 ]]
+
+section "waiting for the following persistent keepalive"
+sleep 6
+keepalives=$(tcpdump -r $pcap 2>/dev/null | grep "UDP, length 32" | wc -l)
+echo "keepalives $keepalives"
+[[ $keepalives -eq 3 ]]
+
section "ALL TESTS PASSED!"