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.
Bob Halley [Thu, 18 Jun 2020 23:09:47 +0000 (16:09 -0700)]
Fix rdata pickling.
Coverage testing showed that while rdatas would pickle and unpickle
apparently successfully, in fact only the slots from the deepest class
in the inheritance chain would be restored. So, e.g., a restored A rdata
would have an address attribute but no rdclass or rdtype attributes,
and so things like rdata comparison would break.
This change preserves the whole set of slots, from all ancestors as
well as the object, as a dictionary.
Bob Halley [Thu, 18 Jun 2020 14:20:50 +0000 (07:20 -0700)]
Construct socket.gaierror with an errno and a string, as doing just the
errno doesn't cause the errno field in the exception to be set, and thus
our exceptions were different and less useful than the stock ones.
Adjust gethostbyaddr() to filter addresses like the system one does.
Brian Wellington [Thu, 18 Jun 2020 02:15:07 +0000 (19:15 -0700)]
Simplify renderer code.
Use context manager to avoid duplicating length checking in many places.
Change the code dealing with EDNS options to avoid lots of seeking by
not rendering directly into the file.
Bob Halley [Tue, 16 Jun 2020 15:21:01 +0000 (08:21 -0700)]
Fix the DoH v6 literal fix.
My first try at this did not play well with the refactoring of
_destination_and_source, as there will now be an af if source has one
and destination doesn't. We only want to make special literal URLs when
the destination is a literal.
Bob Halley [Tue, 16 Jun 2020 14:57:59 +0000 (07:57 -0700)]
Overhaul _destination_and_source.
We now use dns.inet.low_level_address_tuple() for the low-level tuple
conversion.
We now detect mismatches between source and destination address families.
If a source_port has been specified but we have no idea about the
family, complain. (This can only happen when 'where' is a URL and no
source address has been specified either.)
'where' MUST be an address literal unless being called by DoH code, but we
tolerated failures in other cases.
In the DoH case where 'where' was a URL and source was specified, the
lack of an address family in the destination caused us to return None
for the source, and thus not set it even though the caller asked for it.
We now infer the address family from the source address in that case.
dependabot[bot] [Sun, 14 Jun 2020 20:03:35 +0000 (20:03 +0000)]
Update mypy requirement from ^0.770 to ^0.780
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.770...v0.780)
dependabot[bot] [Sun, 14 Jun 2020 20:03:28 +0000 (20:03 +0000)]
Update trio requirement from ^0.14 to >=0.14,<0.17
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.16.0)