Use AI_ADDRCONFIG hint with getaddrinfo if available.

This prevents failure of openssl s_server socket binding to wildcard
address on hosts with disabled IPv6.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8550)
This commit is contained in:
Tomas Mraz 2019-03-21 13:17:29 +01:00 committed by Richard Levitte
parent 0770c88215
commit b8472b4e67

View File

@ -683,6 +683,12 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
hints.ai_family = family;
hints.ai_socktype = socktype;
hints.ai_protocol = protocol;
#ifdef AI_ADDRCONFIG
#ifdef AF_UNSPEC
if (family == AF_UNSPEC)
#endif
hints.ai_flags |= AI_ADDRCONFIG;
#endif
if (lookup_type == BIO_LOOKUP_SERVER)
hints.ai_flags |= AI_PASSIVE;