Bob Halley [Sat, 27 Jan 2024 13:45:35 +0000 (05:45 -0800)]
Fix elliptic curve test deprecation warning from cryptography 42.
We were passing a curve class as the curve parameter in
testSignatureECDSAP256SHA256 and testSignatureECDSAP384SHA384,
not an instance of the curve class. The official API has
always been to pass an instance, but it tolerated passing a class.
Starting with Cryptogrphy 42, passing a class is deprecated.
dependabot[bot] [Mon, 15 Jan 2024 20:54:43 +0000 (12:54 -0800)]
Bump readthedocs-sphinx-search from 0.3.1 to 0.3.2 (#1033)
Bumps [readthedocs-sphinx-search](https://github.com/readthedocs/readthedocs-sphinx-search) from 0.3.1 to 0.3.2.
- [Changelog](https://github.com/readthedocs/readthedocs-sphinx-search/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/readthedocs/readthedocs-sphinx-search/commits/0.3.2)
Brian Wellington [Wed, 20 Dec 2023 22:09:34 +0000 (14:09 -0800)]
Add prefer_truncation to Message.to_wire(). (#1023)
If a caller passes prefer_truncation=True, the message will be truncated
if it would otherwise exceed the maximum length. If the truncation
occurs before the additional section, the TC bit will be set.
This behavior matches what a name server would do when generating a
response.
Bob Halley [Fri, 15 Dec 2023 02:04:39 +0000 (18:04 -0800)]
Ensure asyncio datagram sockets on windows have had a bind() before
recvfrom().
The fix for [#637] erroneously concluded that that windows asyncio
needed connected datagram sockets, but subsequent further
investation showed that the actual problem was that windows wants
an unconnected datagram socket to be bound before recvfrom is called.
Linux autobinds in this case to the wildcard address and port, so
that's why we didn't see any problems there. We now ensure that
the source is bound.
dependabot[bot] [Fri, 3 Nov 2023 19:30:23 +0000 (12:30 -0700)]
Update trio requirement from >=0.14,<0.23 to >=0.14,<0.24 (#1003)
Updates the requirements on [trio](https://github.com/python-trio/trio) to permit the latest version.
- [Release notes](https://github.com/python-trio/trio/releases)
- [Commits](https://github.com/python-trio/trio/compare/v0.14.0...v0.23.0)
If a caller passes prepend_length=True, the wire format will include the
2 byte encoded message length before the message itself. This is useful
for callers planning to send the message over TCP, DoT, and DoQ.
Bob Halley [Fri, 27 Oct 2023 15:55:10 +0000 (08:55 -0700)]
Fix a race condition in trio quic shutdown.
It was possible to have a "lost wakeup" situation where we had stuff to
send but the trio worker was blocked indefinitely in the receive.
There is no test for this as the race is very race-y and I can't reproduce it
reliably in the test suite, though I was able to do reliable replication a different
way when debugging.
I also reordered event processing to happen after timer handling but before sending
in the trio and sync quic code. The async code already worked this way due to its
different struture and needed no changes.
Bob Halley [Fri, 27 Oct 2023 01:41:36 +0000 (18:41 -0700)]
The "address" passed to QUIC receive_datagram() should be a low-level tuple.
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.
Bob Halley [Sun, 22 Oct 2023 14:12:41 +0000 (07:12 -0700)]
Fix two QUIC issues:
1) We treated stream reset like connection terminated, which
is just wrong. We should send EOF to the stream but leave
the connection alone.
2) When we got an unexpected EOF on a stream, we raised the
exception in the wrong place, killing the QUIC connection
but leaving the stream blocked. Now we deliver the exception
to the stream and don't kill the connection.
Bob Halley [Sat, 21 Oct 2023 13:38:54 +0000 (06:38 -0700)]
Check that a relative name plus the zone's origin is not too long. (#997)
Previously it was possible to add very long relative names to a
relative zone which could never be rendered due to being too long for
wire format. Now we check this as part of _validate_name().
This code also removes duplicated name validation code from Zone and
Version, consolidating it into one helper function.
Finally, we fix a few comments in get methods that have cut-and-paste
typos from the find variant indicating they can raise KeyError when
they cannot.
Brian Wellington [Tue, 10 Oct 2023 18:29:27 +0000 (11:29 -0700)]
Fix enum inversion.
A change in Python 3.11's enum module caused IntEnum inversion to only
invert the bits associated with the (inferred) range of the flag,
meaning that ~dns.flags.DO only inverted 16 bits. This meant that
calling want_dnssec(False) on a message would unconditionally set the
EDNS version field to 0.
Bob Halley [Sat, 5 Aug 2023 20:35:29 +0000 (13:35 -0700)]
Fix unintended "wait forever" behavior with zero timeouts [#976].
In a few places we did "if timeout:" or "if expiration:" when we
really meant "if timeout is not None:". This meant that in the zero
timeout case we fell into the "wait forever" path instead of
immediately timing out. In the case of UDP queries, we'd be waiting
on recvfrom() and if a packet was lost, then the code would never wake
up.
Update wheel requirement from ^0.40.0 to ^0.41.0 (#965)
Updates the requirements on [wheel](https://github.com/pypa/wheel) to permit the latest version.
- [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.40.0...0.41.0)
Use `Sequence` instead of `List` for nameservers, as List is invariant (#961)
without this, resolver.nameservers = string.split() produces mypy error, see
https://mypy.readthedocs.io/en/stable/common_issues.html#invariance-vs-covariance