Fixing query_client failing with IPv6
* Change query_client to use rsplit to split ip to make sure we can handle IPv6 addresses. * Strip brackets from ip address to make sure dig does not fail if the IPv6 is uri formatted. Change-Id: I2619fab9eb7e35579566cac70e2e718dae474be0
This commit is contained in:
parent
e57bcbb1ca
commit
1096ab9889
@ -60,7 +60,7 @@ class SingleQueryClient(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _dig(cls, name, rdatatype, ip, port, timeout):
|
def _dig(cls, name, rdatatype, ip, port, timeout):
|
||||||
query = cls._prepare_query(name, rdatatype)
|
query = cls._prepare_query(name, rdatatype)
|
||||||
return dns.query.udp(query, ip, port=port, timeout=timeout)
|
return dns.query.udp(query, ip.strip('[]'), port=port, timeout=timeout)
|
||||||
|
|
||||||
|
|
||||||
class Nameserver(object):
|
class Nameserver(object):
|
||||||
@ -78,6 +78,6 @@ class Nameserver(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_str(self, nameserver):
|
def from_str(self, nameserver):
|
||||||
if ':' in nameserver:
|
if ':' in nameserver:
|
||||||
ip, port = nameserver.split(':')
|
ip, port = nameserver.rsplit(':', 1)
|
||||||
return Nameserver(ip, int(port))
|
return Nameserver(ip, int(port))
|
||||||
return Nameserver(nameserver)
|
return Nameserver(nameserver)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user