Brian Wellington [Tue, 30 Jun 2020 16:27:06 +0000 (09:27 -0700)]
Remove the concept from "first" from TSIG.
The sign() and validate() routines took a "first" parameter, which
indicated that this message was the first in a multi-message sequence.
This isn't needed, as it's identical to "not (ctx and multi)".
Remove the parameter from both, as well as the now-unneeded field in the
message object and message.from_wire() parameter.
Bob Halley [Mon, 29 Jun 2020 01:53:20 +0000 (18:53 -0700)]
Remove no longer needed code to activate EDNS if setting an extended
rcode and EDNS has not previously been activated. The code is no longer
needed as setting ednsflags to a nonzero value will automatically make
an opt RR and enable EDNS.
Brian Wellington [Fri, 26 Jun 2020 20:59:59 +0000 (13:59 -0700)]
Attempt to refactor per-opcode validation.
Instead of validating rrsets and sections after parsing them, check the
class/type for each record before parsing it. This is more generic,
because it moves all of the update logic out of the common code. It's
also more flexible, as it allows the update logic to specify that
meta-records are empty.
Brian Wellington [Fri, 26 Jun 2020 18:30:29 +0000 (11:30 -0700)]
Minor _WireReader refactoring.
Instead of parsing the header to determine which Message subclass to
create and passing that message to _WireReader, make _WireReader create
the Message subclass itself.
Brian Wellington [Thu, 25 Jun 2020 00:04:59 +0000 (17:04 -0700)]
Fix TTL limiting.
The message code would convert negative TTL into 0, but the TTL could
never be negative, as it was read with the '!I' format, which reads
unsigned 32 bit integers. We don't want to change that, since OPT flags
(which are encoded in the TTL) should be treated as unsigned. Instead,
treat all TTLs > (2^31 - 1) as 0.
dependabot[bot] [Wed, 24 Jun 2020 05:43:45 +0000 (05:43 +0000)]
Update mypy requirement from ^0.781 to ^0.782
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.781...v0.782)
Brian Wellington [Tue, 23 Jun 2020 23:46:48 +0000 (16:46 -0700)]
Add more functionality to nanonameserver.
- When no port is specified, pick the same port for UDP and TCP, so that
TCP fallback can be tested.
- Change handlers to get a single Request object instead of individual
parameters. The Request object contains the message, peer, and
connection_type previously passed, and also adds the local address and
wire format message. Additionally, it provides convenient properties
for accessing the question.
Bob Halley [Tue, 23 Jun 2020 01:07:25 +0000 (18:07 -0700)]
The cached _all_slots technique of the earlier pickle fix didn't work for
GenericRdata or for directly imported types. This fix just computes the
all slots relatively efficiently every __getstate__().
dependabot[bot] [Mon, 22 Jun 2020 05:44:40 +0000 (05:44 +0000)]
Update mypy requirement from ^0.780 to ^0.781
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.780...v0.781)
Bob Halley [Fri, 19 Jun 2020 16:23:52 +0000 (09:23 -0700)]
Make _cmp generic for all EDNS Options. It now compares the wire formats
of two objects of the same class.
Previously we did type-specific stuff for ECSOption, but we only
checked the padded address info, not the srclen or scopelen, so
different options could compare the same. Also, it's not clear that
there's any better semantic ordering of options than the wire format,
so we will just go for simplicity and use the generic implementation.