From 556e4bd74d3536fd951acaa410b89a2e81de7d54 Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Mon, 29 Jul 2013 14:21:46 +0400 Subject: [PATCH] Don't resolve AAAA records if there is no dnspython nor IPv6 support If system doesn't has IPv6 support or dnspython package, socket.getaddrinfo with AF_INET6 flag return weird IP info for requested host, making SleekXMPP crush with more weird error. --- sleekxmpp/xmlstream/resolver.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py index 4cac254c..6f26797f 100644 --- a/sleekxmpp/xmlstream/resolver.py +++ b/sleekxmpp/xmlstream/resolver.py @@ -202,6 +202,9 @@ def get_AAAA(host, resolver=None): # If not using dnspython, attempt lookup using the OS level # getaddrinfo() method. if resolver is None: + if not socket.has_ipv6: + log.debug("Unable to query %s for AAAA records: IPv6 is not supported", host) + return [] try: recs = socket.getaddrinfo(host, None, socket.AF_INET6, socket.SOCK_STREAM)