Endpoint address dns resolution - option to prefer IPv6 or IPv4
aranea at aixah.de
Sat Mar 14 17:52:28 CET 2020
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
> 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:
As you can see, wg resolves host names through the libc's getaddrinfo()
function, and simply uses the first ip address returned by that
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.
More information about the WireGuard