All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Ressel <aranea@aixah.de>
To: Torsten Krah <krah.tm@gmail.com>
Cc: wireguard@lists.zx2c4.com
Subject: Re: Endpoint address dns resolution - option to prefer IPv6 or IPv4
Date: Sat, 14 Mar 2020 16:52:28 +0000	[thread overview]
Message-ID: <20200314165228.jxydplbghnri2ktm@vega> (raw)
In-Reply-To: <327df26ff0e515425bc0b18084117b7ae065d97b.camel@gmail.com>

On Fri, Mar 13, 2020 at 03:52:19PM +0100, Torsten Krah wrote:
> I've got an endpoint with a DNS name which has both, an A and AAAA
> record.
> I would like to configure the client, so that I can tell him, to either
> prefer IPv6 or IPv4 for the vpn connection.

The relevant source code can be found here:
https://git.zx2c4.com/wireguard-tools/tree/src/config.c#n242

As you can see, wg resolves host names through the libc's getaddrinfo()
function, and simply uses the first ip address returned by that
function.

A standards-compliant implementation should return an ipv6 address in
the first position if one is available and the host has a working
connection to the v6 internet. As far as I know, both glibc and musl do
this (though the behaviour of glibc can be modified by editing
/etc/gai.conf); I'm not sure what other libcs do.

It would of course be possible to make this behaviour configurable for
wg; we just need to figure out if that's an useful feature, and what the
exact semantics should be.

Cheers,
Luis

  parent reply	other threads:[~2020-03-14 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 14:52 Endpoint address dns resolution - option to prefer IPv6 or IPv4 Torsten Krah
2020-03-14  7:40 ` Stefan Tatschner
2020-03-14 14:53   ` Torsten Krah
     [not found] ` <CAADpXXY7ajNwRoF1sivACxUfFj-SpWf6o6+1Uq2N0XzEp3bvTw@mail.gmail.com>
2020-03-14 14:51   ` Torsten Krah
2020-03-16  5:05     ` Roman Mamedov
2020-03-16  8:30       ` Torsten Krah
2020-03-14 16:52 ` Luis Ressel [this message]
2020-03-14 17:08   ` Matthias Urlichs
2020-03-14 18:03     ` Luis Ressel

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=20200314165228.jxydplbghnri2ktm@vega \
    --to=aranea@aixah.de \
    --cc=krah.tm@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.