Bug in helper contrib/examples/reresolve-dns/reresolve-dns.sh

Conrad Meyer cem at freebsd.org
Tue Nov 26 23:40:47 CET 2019


reresolve-dns.sh seems to have a bug where interfaces with more than a
single peer configured do not match the output of "latest-handshakes"
correctly.  Chiefly, the ^ and $ regex anchors in the script match on
the full, multiline output of 'wg foo latest-handshakes' in bash,
rather than matching on individual lines (which is clearly the

This is observed on both bash 4.4.23 and 5.0.11.

The easiest fix to this problem is simply to remove the anchors.
There should be no issue with false positive matching, nor correctly
parsing the last handshake time.  With this minor change,
reresolve-dns.sh actually functions on my host with two peers

I did not spot any obvious way to change bash's regex line-matching
behavior.  If that exists, it may be preferable.

Thank you,

More information about the WireGuard mailing list