]> xenbits.xensource.com Git - libvirt.git/commitdiff
virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable
authorGuido Günther <agx@sigxcpu.org>
Tue, 11 Aug 2015 09:49:18 +0000 (11:49 +0200)
committerGuido Günther <agx@sigxcpu.org>
Tue, 11 Aug 2015 20:08:50 +0000 (22:08 +0200)
When running the test suite using "unshare -n" we might have IPv6 but no
configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
EAI_NONAME which we should then treat as IPv6 unavailable.

src/rpc/virnetsocket.c

index 106d09aaf971422af82a2ecd383f1203f0323a97..5e5f1ab25e739a99d770d97888564762b274242e 100644 (file)
@@ -183,7 +183,8 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
 
     if ((gaierr = getaddrinfo("::1", NULL, &hints, &ai)) != 0) {
         if (gaierr == EAI_ADDRFAMILY ||
-            gaierr == EAI_FAMILY) {
+            gaierr == EAI_FAMILY ||
+            gaierr == EAI_NONAME) {
             *hasIPv6 = false;
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,