Fix DNS resolution: NS name bug, glue bypass, FormatRecord duplicate header, result deduplication #23

Merged
gary merged 1 commits from agent/go-expert-developer/da16f960 into main 2026-06-08 10:21:10 +00:00
Contributor

Fixes for issue HAN-402 — Refine / Fix report on DNS lookups

Changes

  • Bug 1 (traverser.go): Fixed NS resolver using ref.Bailiwick instead of ref.Name — was resolving the query domain instead of the NS hostname, causing all "could not be resolved" failures
  • Bug 2 (traverser.go/referral.go): Fixed visited-set check to only skip children with no addresses; glue-resolved children are now queried directly
  • Bug 3 (dns/decode.go): Fixed FormatRecord to return rr.String() directly instead of prepending duplicate header fields
  • Deduplication (output/stats.go, output/text.go): Added DeduplicateResults to group terminal results by NS+answer, summing probabilities

Verified output for 800adventures.com.au

Results:
      33.3% ns-b.hansenits.com answered with 13.54.63.231
      33.3% ns-c.hansenits.com answered with 13.54.63.231
      33.3% ns-a.hansenits.com answered with 13.54.63.231

Summary:
   100% answered with 13.54.63.231

Code reviewed and approved by Code Reviewer agent.

Fixes for issue HAN-402 — Refine / Fix report on DNS lookups ## Changes - **Bug 1 (traverser.go):** Fixed NS resolver using `ref.Bailiwick` instead of `ref.Name` — was resolving the query domain instead of the NS hostname, causing all "could not be resolved" failures - **Bug 2 (traverser.go/referral.go):** Fixed visited-set check to only skip children with no addresses; glue-resolved children are now queried directly - **Bug 3 (dns/decode.go):** Fixed `FormatRecord` to return `rr.String()` directly instead of prepending duplicate header fields - **Deduplication (output/stats.go, output/text.go):** Added `DeduplicateResults` to group terminal results by NS+answer, summing probabilities ## Verified output for `800adventures.com.au` ``` Results: 33.3% ns-b.hansenits.com answered with 13.54.63.231 33.3% ns-c.hansenits.com answered with 13.54.63.231 33.3% ns-a.hansenits.com answered with 13.54.63.231 Summary: 100% answered with 13.54.63.231 ``` Code reviewed and approved by Code Reviewer agent.
multica-agent added 1 commit 2026-06-08 10:19:27 +00:00
Three bugs fixed:

1. processReferral was calling ResolveNS with ref.Name (the query domain,
   e.g. '800adventures.com.au.') instead of ref.Bailiwick (the NS hostname,
   e.g. 'ns-a.hansenits.com.'). This caused the sub-traversal to look up the
   wrong name and always fail to find the nameserver's IP address.

2. In ResolveNS (and Referral.Resolve), child referrals whose name matched the
   visited set were unconditionally skipped. When the .com TLD returns glue A
   records for the target NS alongside its delegation, the child referral has
   addresses and should be queried directly rather than skipped.

3. FormatRecord was prepending the DNS header fields and then appending
   rr.String() which already includes those same fields, producing doubled
   output like 'example.com. 300 IN A example.com. 300 IN A 1.2.3.4'.
   Now simply returns rr.String().

Additional improvements:
- Results section deduplicates terminal results: same NS failure or same
  (NS, answer) pair is merged with summed probability, avoiding the same
  nameserver appearing 15 times with 6.7% each.
- Result lines now include the NS hostname (from Bailiwick) and use the
  compact rdata format, e.g. '33% ns-a.hansenits.com answered with 13.54.63.231'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: multica-agent <github@multica.ai>
gary merged commit 683a2a69fa into main 2026-06-08 10:21:10 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HansenITSolutions/ExploreDNS#23