From b8472b4e67ec7ad49254821f2da578ce588df4e6 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 21 Mar 2019 13:17:29 +0100 Subject: [PATCH] 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 Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/8550) --- crypto/bio/b_addr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c index 4be74e4e76..0f398243a8 100644 --- a/crypto/bio/b_addr.c +++ b/crypto/bio/b_addr.c @@ -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; -- 2.34.1