0c50f5
From a3f4cd5019b60649f6eb216ebe99caa43cd96f8e Mon Sep 17 00:00:00 2001
0c50f5
From: Daiki Ueno <dueno@redhat.com>
0c50f5
Date: Mon, 26 Apr 2021 14:40:17 +0200
0c50f5
Subject: [PATCH] BIO_lookup_ex: use AI_ADDRCONFIG only if explicit host name
0c50f5
 is given
0c50f5
0c50f5
The flag only affects which record types are queried (A or AAAA, or
0c50f5
both), and when node is NULL, it prevents getaddrinfo returning the
0c50f5
right address associated with the loopback interface.
0c50f5
0c50f5
Signed-off-by: Daiki Ueno <dueno@redhat.com>
0c50f5
---
0c50f5
 crypto/bio/b_addr.c | 2 +-
0c50f5
 1 file changed, 1 insertion(+), 1 deletion(-)
0c50f5
0c50f5
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
0c50f5
index b023bbda40..ea15601f3d 100644
0c50f5
--- a/crypto/bio/b_addr.c
0c50f5
+++ b/crypto/bio/b_addr.c
0c50f5
@@ -689,7 +689,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
0c50f5
         hints.ai_protocol = protocol;
0c50f5
 # ifdef AI_ADDRCONFIG
0c50f5
 #  ifdef AF_UNSPEC
0c50f5
-        if (family == AF_UNSPEC)
0c50f5
+        if (host != NULL && family == AF_UNSPEC)
0c50f5
 #  endif
0c50f5
             hints.ai_flags |= AI_ADDRCONFIG;
0c50f5
 # endif
0c50f5
-- 
0c50f5
2.30.2
0c50f5