summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-04-04 17:22:00 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:35 -0600
commiteb34a0b76b960cb9d949c39d5a1c5e0ba2283720 (patch)
treeda2ed9486a15134fb4a023d0cdbe5e94d253163d /tests
parentc380f07dfe70d408c13e15a8cc83e7b3e152defe (diff)
downloadhqemu-eb34a0b76b960cb9d949c39d5a1c5e0ba2283720.zip
hqemu-eb34a0b76b960cb9d949c39d5a1c5e0ba2283720.tar.gz
util: retry getaddrinfo if getting EAI_BADFLAGS with AI_V4MAPPED
The FreeBSD header files define the AI_V4MAPPED but its implementation of getaddrinfo() always returns an error when that flag is set. eg address resolution failed for localhost:9000: Invalid value for ai_flags There are also reports of the same problem on OS-X 10.6 Since AI_V4MAPPED is not critical functionality, if we get an EAI_BADFLAGS error then just retry without the AI_V4MAPPED flag set. Use a static var to cache this status so we don't have to retry on every single call. Also remove its use from the test suite since it serves no useful purpose there. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1459786920-15961-1-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-io-channel-socket.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c
index 9d94adb..855306b 100644
--- a/tests/test-io-channel-socket.c
+++ b/tests/test-io-channel-socket.c
@@ -27,9 +27,6 @@
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
#endif
-#ifndef AI_V4MAPPED
-# define AI_V4MAPPED 0
-#endif
#ifndef EAI_ADDRFAMILY
# define EAI_ADDRFAMILY 0
#endif
@@ -42,7 +39,7 @@ static int check_bind(const char *hostname, bool *has_proto)
int ret = -1;
memset(&ai, 0, sizeof(ai));
- ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG;
+ ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
ai.ai_family = AF_UNSPEC;
ai.ai_socktype = SOCK_STREAM;
OpenPOWER on IntegriCloud