summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2021-07-08 19:22:36 +0200
committerPauli <pauli@openssl.org>2021-07-13 11:28:04 +1000
commit474cd196d628b1f91efa32827b403e2c1d896f81 (patch)
tree849d969d078afd0e0ae100b2686b1349ece0ec6d /crypto
parent5b71c677781ca260c8d9968c103d92c44d644007 (diff)
BIO_lookup_ex: use AI_ADDRCONFIG only if explicit host name is given
The flag only affects which record types are queried via DNS (A or AAAA, or both). When node is NULL and AF_UNSPEC is used, it prevents getaddrinfo returning the right address associated with the loopback interface. Signed-off-by: Daiki Ueno <dueno@redhat.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16039)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/b_addr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index b023bbda40..ea15601f3d 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -689,7 +689,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
hints.ai_protocol = protocol;
# ifdef AI_ADDRCONFIG
# ifdef AF_UNSPEC
- if (family == AF_UNSPEC)
+ if (host != NULL && family == AF_UNSPEC)
# endif
hints.ai_flags |= AI_ADDRCONFIG;
# endif