diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2019-03-21 13:17:29 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-04-03 22:56:54 +0200 |
commit | b8472b4e67ec7ad49254821f2da578ce588df4e6 (patch) | |
tree | c0d13da7f0e5ba49f02da8ac39918be1febaf638 /crypto | |
parent | 0770c882150ea0159cc2b0a2cea2e8ed8442f36f (diff) |
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)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/b_addr.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |