]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Do not lose scope info. [Issue #283]
authorBob Halley <halley@dnspython.org>
Mon, 4 May 2020 15:00:25 +0000 (08:00 -0700)
committerBob Halley <halley@dnspython.org>
Mon, 4 May 2020 15:00:25 +0000 (08:00 -0700)
dns/query.py

index b995003f418ed056f741352bc68f71e32c4a1613..8e22570562a1565b2fee89ff055df6c1bb4b2dbb 100644 (file)
@@ -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