[Spice-devel] [PATCH 1/2] spice client: fix dns lookup

Gerd Hoffmann kraxel at redhat.com
Fri Feb 19 03:21:02 PST 2010


ignore lookup results which are not ipv4

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 client/red_peer.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index bdbf1ff..f252ef2 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -77,6 +77,8 @@ uint32_t RedPeer::host_by_name(const char* host)
     int rc;
 
     rc = getaddrinfo(host, NULL, NULL, &result);
+    while (result != NULL && result->ai_family != PF_INET)
+        result = result->ai_next;
     if (rc != 0 || result == NULL) {
         THROW_ERR(SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED, "cannot resolve host address %s", host);
     }
-- 
1.6.6



More information about the Spice-devel mailing list