wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Conrad Meyer <cem@freebsd.org>
To: wireguard@lists.zx2c4.com
Subject: Bug in helper contrib/examples/reresolve-dns/reresolve-dns.sh
Date: Tue, 26 Nov 2019 14:40:47 -0800	[thread overview]
Message-ID: <CAG6CVpU7L67oBqM5vi7-oXfYN=jMF9urvfxz_qZqFjdm-a+F=A@mail.gmail.com> (raw)

Hi,

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
intent).

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
configured.

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

Thank you,
Conrad
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

             reply	other threads:[~2019-11-27  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 22:40 Conrad Meyer [this message]
2019-11-27 12:31 ` Bug in helper contrib/examples/reresolve-dns/reresolve-dns.sh Jason A. Donenfeld
2019-11-27 18:23   ` Conrad Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG6CVpU7L67oBqM5vi7-oXfYN=jMF9urvfxz_qZqFjdm-a+F=A@mail.gmail.com' \
    --to=cem@freebsd.org \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).