summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2019-03-21 13:17:29 +0100
committerRichard Levitte <levitte@openssl.org>2019-04-04 01:25:08 +0200
commit2423b5f07f01a7318fb48a277c1c4f372958d664 (patch)
tree5612cda64fc0dfc592f7c2eb6b82a8e5f829c5ef /crypto/bio
parenta88bafcdb7c24a14c277e47cdde014886a91d7cc (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) (cherry picked from commit b8472b4e67ec7ad49254821f2da578ce588df4e6)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_addr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 4395ab7a06..f295b766fa 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;