]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
The "address" passed to QUIC receive_datagram() should be a low-level tuple.
authorBob Halley <halley@dnspython.org>
Fri, 27 Oct 2023 01:41:36 +0000 (18:41 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 27 Oct 2023 01:41:36 +0000 (18:41 -0700)
Previously we sent just the address part, i.e. lltuple[0], but the
aioquic code intends for the value to be the whole tuple.  This did
not break anything for dnspython as we were consistently wrong and
aioquic is flexible enough with its notion of NetworkAddress for our
purposes that dnspython's mistake had no effect.

dns/quic/_asyncio.py
dns/quic/_common.py
dns/quic/_sync.py
dns/quic/_trio.py

index b05748309d07e7654a41e32d58b08f5a6ba5da81..57c9910b03ab59fb4eb55a992613f6ad41b935d7 100644 (file)
@@ -101,9 +101,7 @@ class AsyncioQuicConnection(AsyncQuicConnection):
                     )
                     if address[0] != self._peer[0] or address[1] != self._peer[1]:
                         continue
-                    self._connection.receive_datagram(
-                        datagram, self._peer[0], time.time()
-                    )
+                    self._connection.receive_datagram(datagram, address, time.time())
                     # Wake up the timer in case the sender is sleeping, as there may be
                     # stuff to send now.
                     async with self._wake_timer:
@@ -125,7 +123,7 @@ class AsyncioQuicConnection(AsyncQuicConnection):
         while not self._done:
             datagrams = self._connection.datagrams_to_send(time.time())
             for datagram, address in datagrams:
-                assert address == self._peer[0]
+                assert address == self._peer
                 await self._socket.sendto(datagram, self._peer, None)
             (expiration, interval) = self._get_timer_values()
             try:
index e4a9f18dbd180d688cb8dc7dd6c3fa4e092114f8..4cbdcae1d714778088a0e1d2c6b7ac125e6e9886 100644 (file)
@@ -164,7 +164,8 @@ class BaseQuicManager:
         if connection is not None:
             return (connection, False)
         qconn = aioquic.quic.connection.QuicConnection(configuration=self._conf)
-        qconn.connect(address, time.time())
+        lladdress = dns.inet.low_level_address_tuple((address, port))
+        qconn.connect(lladdress, time.time())
         connection = self._connection_factory(
             qconn, address, port, source, source_port, self
         )
index 6e13cad49ab6aaa28363720700a844aff03c8989..25dd6d6ed8d2cbff06359039dc06949f6b7e35fd 100644 (file)
@@ -107,7 +107,7 @@ class SyncQuicConnection(BaseQuicConnection):
             except BlockingIOError:
                 return
             with self._lock:
-                self._connection.receive_datagram(datagram, self._peer[0], time.time())
+                self._connection.receive_datagram(datagram, self._peer, time.time())
 
     def _drain_wakeup(self):
         while True:
index 43c1b1a491db3de7585e023664d01c9f22d8d0c3..1ee702b52bc20cd180f697b88457817b400170ea 100644 (file)
@@ -91,9 +91,7 @@ class TrioQuicConnection(AsyncQuicConnection):
                     deadline=trio.current_time() + interval
                 ) as self._worker_scope:
                     datagram = await self._socket.recv(QUIC_MAX_DATAGRAM)
-                    self._connection.receive_datagram(
-                        datagram, self._peer[0], time.time()
-                    )
+                    self._connection.receive_datagram(datagram, self._peer, time.time())
                 self._worker_scope = None
                 self._handle_timer(expiration)
                 datagrams = self._connection.datagrams_to_send(time.time())