Validate internal PTR DNS responses - #2979
Conversation
|
A new production recurrence has been captured on the unpatched FTL v6.7 installation. The full timestamped evidence and interpretation are recorded on issue #2978: Key observation: two IPv6 PTR timeouts were immediately followed by the IPv4 PTR lookup for There is no packet capture from that exact production event, so it is documented as strong independent corroboration rather than standalone wire-level proof. No change to the draft patch is requested solely from this recurrence. |
|
Confirmed the mechanism on #2978, so this is the right layer to fix it. Using Smaller things:
Drop the PoC wording from the comments before this goes ready - the bug story belongs in the PR and the commit message, not in the code. You wrote on #2978 that the deterministic harness can be supplied separately. I would rather have it in Worth deciding separately: |
|
Split the four independent bool-return cleanups into #3027 as requested. |
2b11306 to
4b2d72a
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
The conflict in One thing left in the TCP path. Three |
Correlate received UDP datagrams with the active PTR request, bound UDP and TCP parsing to the received DNS message length, and add deterministic regression coverage for stale responses.\n\nRefs pi-hole#2978 Signed-off-by: Gisle Enåsen <6815997+brealorg@users.noreply.github.com>
4b2d72a to
8b99bac
Compare
|
Conflicts have been resolved. |
|
Rebased onto current
The exact rebased tree passed locally in the current FTL build image: 193 BATS tests, 151 pytest API tests, 12 DoT/DoH client tests, 25 DoT/DoH server tests, 9 final validation tests, and the TLS terminator test. Fresh GitHub workflows are now awaiting maintainer approval. |
What does this implement/fix?
The internal PTR resolver reuses one UDP socket across sequential lookups. If a lookup times out, a delayed response from that lookup can remain queued and be consumed while the resolver is waiting for the next lookup.
This change correlates received UDP DNS datagrams with the active PTR request before parsing them. It:
QR, opcode, transaction ID andQDCOUNT;CLOCK_MONOTONICdeadline;recvfrom()byte count as the UDP parser boundary;request_idfrom the finaldns.id;test/for the stale-response sequence.The independent
return NULL;→return false;cleanup identified during review was split into #3027 and has already landed separately. The three remaining cases in thisboolresolver function were corrected here during the rebase as requested.How to test the change during review
The regression harness deliberately delays response A past the resolver timeout, waits for request B on the same UDP socket, then sends the stale A response before the correct B response.
On the pre-rebase baseline used to demonstrate the regression (
a17efdd3307a233172d2f3b0d1e2ead5f9c85302):With this change applied:
The harness is integrated into the normal test suite as
PTR stale-response regression harness.The exact rebased change, based on
developmentat1945de4f22e0af14ad2b323c3437bda4cb3210f3, was also built and tested in the currentghcr.io/pi-hole/ftl-build:v2.25environment:The earlier full-daemon reproduction documented on #2978 remains independent corroboration of the same stale-response mechanism.
Additional information
Related issue or feature (if applicable): Refs #2978
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
src/dnsmasq/.Checklist:
developmentbranch.