Weirdness on timing of HS request packets when keepalive==5
M Rubon <[email protected]> Mon, 16 Feb 2026 13:20:27 -0500
| Newsgroups | com.zx2c4.lists.wireguard |
|---|---|
| Message-ID | <CAJ24mqDazye5cEu6LzQ_v3VnP-OgTwj=+yMU7tp+_hPChfaNKg@mail.gmail.com> |
I am looking at the timing interval between HS request packets during the 90s attempt period. I see different interval timing depending on the (basically unrelated) persistent-keepalive value. I suspect the timer for persistent-keepalive==5 is interfering with the timer for "try HS request again". It is not a massive difference, but it does not match the expected 5+jitter seconds suggested in the documentation, and has interesting consequences. In one case, two of my peers were each sending HS attempts to the other at the same time (almost no randomness), and those HS requests were crossing in the night and being repeatedly ignored because the peer had also sent a HS request (tcpdump available on request). It took a while before they finally completed a full HS. I have a useful workaround to avoid issues for my use case, but wanted to highlight the possibility of keepalive timers at 5s lightly interfering with the "try HS again" timers. M. Environment: OpenWRT v25.12 kernel 6.12 (same issue on kernel 5.4) Trying to connect to a (non-existent) peer over loopback port 5656 Monitoring: tcpdump -nnttt -i lo udp port 5656 When keepalive is 13, the interval between HS packets is 5.x seconds and jitter is decently random 00:00:05.119975 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.759944 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.760015 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.760014 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.120015 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.759989 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.760028 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.760008 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.119940 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.120033 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.039978 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.200242 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.759820 IP6 ::1.50737 > ::1.5656: UDP, length 148 When keepalive is 5, the interval between HS packets is 5.0x seconds and jitter is clamped to under 10ms 00:00:05.039878 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.040018 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.039979 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.040000 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.040104 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.039900 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.040112 IP6 ::1.50737 > ::1.5656: UDP, length 148 00:00:05.039838 IP6 ::1.50737 > ::1.5656: UDP, length 148