mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-06-09 08:59:57 -04:00
Mention address if not unspecific on DNS failure
With the recent changes breaking configs that included lport 0, it became apparent that having the address family in the error message when resolving fails, would have made diagnosis in this case and probably others much easier. Change-Id: I1c8fcd5bb6e1fa0020d52879eefbafdb2630e7b5 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250325195750.7899-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31237.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
c91948a0e0
commit
d167815318
1 changed files with 19 additions and 2 deletions
|
|
@ -445,6 +445,22 @@ err:
|
|||
throw_signal_soft(SIGHUP, "Preresolving failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Small helper function for openvpn_getaddrinfo to print the address
|
||||
* family when resolving fails
|
||||
*/
|
||||
static const char *
|
||||
getaddrinfo_addr_family_name(int af)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET: return "[AF_INET]";
|
||||
|
||||
case AF_INET6: return "[AF_INET6]";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate IPv4/IPv6 addr or hostname into struct addrinfo
|
||||
* If resolve error, try again for resolve_retry_seconds seconds.
|
||||
|
|
@ -545,11 +561,11 @@ openvpn_getaddrinfo(unsigned int flags,
|
|||
print_hostname = "undefined";
|
||||
}
|
||||
|
||||
fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s)";
|
||||
fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)";
|
||||
if ((flags & GETADDR_MENTION_RESOLVE_RETRY)
|
||||
&& !resolve_retry_seconds)
|
||||
{
|
||||
fmt = "RESOLVE: Cannot resolve host address: %s:%s (%s) "
|
||||
fmt = "RESOLVE: Cannot resolve host address: %s:%s%s (%s)"
|
||||
"(I would have retried this name query if you had "
|
||||
"specified the --resolv-retry option.)";
|
||||
}
|
||||
|
|
@ -639,6 +655,7 @@ openvpn_getaddrinfo(unsigned int flags,
|
|||
fmt,
|
||||
print_hostname,
|
||||
print_servname,
|
||||
getaddrinfo_addr_family_name(ai_family),
|
||||
gai_strerror(status));
|
||||
|
||||
if (--resolve_retries <= 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue