dirmngr: Handle failures related to missing IPv6 gracefully

* dirmngr/ks-engine-hkp.c (handle_send_request_error): Handle two more
error codes.

--
Handle the two possible connect failures related to missing IPv6 support
gracefully by marking the host dead and retrying with another one.
If IPv6 is disabled via procfs, connect() will return EADDRNOTAVAIL.
If IPv6 is not compiled into the kernel, it will return EAFNOSUPPORT.
This makes it possible to use dual-stack hkp servers on hosts not having
IPv6 without random connection failures.

GnuPG-bug-id: 3331

--

The above description seems to be for Linux, so it is possible that
other systems might behave different.  However, it is worth to try
this patch.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Michał Górny 2018-01-31 16:57:19 +01:00 committed by Werner Koch
parent 641aae783e
commit ecfc4db3a2
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 2 additions and 0 deletions

View File

@ -1353,6 +1353,8 @@ handle_send_request_error (ctrl_t ctrl, gpg_error_t err, const char *request,
case GPG_ERR_UNKNOWN_HOST:
case GPG_ERR_NETWORK:
case GPG_ERR_EIO: /* Sometimes used by estream cookie functions. */
case GPG_ERR_EADDRNOTAVAIL: /* e.g. when IPv6 is disabled */
case GPG_ERR_EAFNOSUPPORT: /* e.g. when IPv6 is not compiled in */
if (mark_host_dead (request) && *tries_left)
retry = 1;
break;