Bring async receive_udp ignore_errors in line with the sync one - #1297
Merged
rthalley merged 1 commit intoAug 29, 2026
Merged
Conversation
ignore_errors means "discard the datagram and keep listening for a valid response", but dns.asyncquery.receive_udp() passed continue_on_error to from_wire(), so a datagram with a valid header and an unparsable body was returned with its errors recorded instead of being skipped. Also removes the ignore_errors parameter added to dns.asyncquery.receive_tcp() at the same time; dns.query.receive_tcp() has no such parameter and nothing passes it.
Owner
|
Oops! Thanks for the fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Differential fuzz of
dns.queryagainstdns.asyncqueryover 400 response datagrams: 120 diverged, every one withignore_errors=True. A control restricted to well-formed wire gave 0/400 before and after.Two datagrams into each twin: a valid header plus trailing junk, then a clean NXDOMAIN response.
The sync twin discards the unparsable datagram and keeps listening, as its docstring promises ("ignore format errors or response mismatches and keep listening for a valid response"), which the async docstring defers to. The async twin returns it with the parse errors recorded.
Blame puts both bodies at f66e25b (2024-02-09).
dns/asyncquery.py:161is 864308a (#1248), which addedcontinue_on_error=ignore_errorsto the async twin only;dns/query.pywas not touched.Do53Nameserver.queryand.async_queryboth passignore_errors=Truefor UDP, sodns.resolveranddns.asyncresolverdisagree on a damaged or injected response. Nothing in dnspython readsMessage.errors, so a salvaged message reaches the resolver looking clean.After the change the same fuzz gives 0 across four seeds.
The
receive_tcphunk is separable: #1248 also gave the asyncreceive_tcpanignore_errorsparameter the sync one lacks and no caller passes. Neither has shipped in a release.test_unparsable_wire_is_skipped_not_salvagedis added to both suites. The async one fails without the source change; the sync one passes either way and pins the authoritative behaviour.