wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Lonnie Abelbeck <lists@lonnie.abelbeck.com>
To: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: wg setconf: ignore Endpoint= DNS failure
Date: Wed, 30 Jan 2019 13:54:43 -0600	[thread overview]
Message-ID: <B9EB3ADC-C243-4414-AD97-E68E61BF9325@lonnie.abelbeck.com> (raw)

Hi Jason and list,

I would like to discuss changing WG's current handling of an Endpoint= DNS failure with "wg setconf ...".

Currently)
"Configuration parsing error",  the configuration is aborted, keeping WG from starting.

Proposed)
Ignore the DNS error, do not change the "endpoint", and continue parsing the configuration so WG can be started.
The current stderr DNS error message will continue to be generated.
Optionally, some users may want to call "reresolve-dns.sh" [1] or similar at a later time(s) to update the DNS derived "endpoint".


I have tested this trivial patch to accomplish the proposed change:
Note: The config.c parse_endpoint() function provides additional sanity checking, only the DNS failure would allow parsing to continue.

--- wireguard-0.0.20190123/src/tools/config.c.orig	2019-01-30 09:02:53.685777217 -0600
+++ wireguard-0.0.20190123/src/tools/config.c	2019-01-30 09:03:44.253387871 -0600
@@ -241,7 +241,7 @@
				timeout >= 90000000) {
			free(mutable);
			fprintf(stderr, "%s: `%s'\n", ret == EAI_SYSTEM ? strerror(errno) : gai_strerror(ret), value);
-			return false;
+			return true;
		}
		fprintf(stderr, "%s: `%s'. Trying again in %.2f seconds...\n", ret == EAI_SYSTEM ? strerror(errno) : gai_strerror(ret), value, timeout / 1000000.0);
		usleep(timeout);


This change effects:
--
wg setconf ...
wg addconf ...
wg set ... endpoint <ip>:<port> ...
--

I propose this will make WireGuard configuration more robust, minimizing the effect of an Endpoint= DNS failure.


Lonnie

[1] https://git.zx2c4.com/WireGuard/tree/contrib/examples/reresolve-dns/reresolve-dns.sh


_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

                 reply	other threads:[~2019-01-30 19:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=B9EB3ADC-C243-4414-AD97-E68E61BF9325@lonnie.abelbeck.com \
    --to=lists@lonnie.abelbeck.com \
    --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).