From: Bob Halley Date: Mon, 4 May 2020 15:00:25 +0000 (-0700) Subject: Do not lose scope info. [Issue #283] X-Git-Tag: v2.0.0rc1~265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9c1b776b1a8cd124160ec313a3aae37c29933cf;p=thirdparty%2Fdnspython.git Do not lose scope info. [Issue #283] --- diff --git a/dns/query.py b/dns/query.py index b995003f..8e225705 100644 --- a/dns/query.py +++ b/dns/query.py @@ -215,11 +215,14 @@ def _destination_and_source(af, where, port, source, source_port, source = '0.0.0.0' source = (source, source_port) elif af == dns.inet.AF_INET6: - destination = (where, port, 0, 0) + ai_flags = socket.AI_NUMERICHOST + ((*_, destination), *_) = socket.getaddrinfo(where, port, + flags=ai_flags) if source is not None or source_port != 0: if source is None: source = '::' - source = (source, source_port, 0, 0) + ((*_, source), *_) = socket.getaddrinfo(source, source_port, + flags=ai_flags) else: source = None destination = None