Allow resolving both IPv4 and IPv6 with --all-nameservers (--no-preference)#604
Merged
Merged
Conversation
…if we're not recycling
This allows dual-stack machines to use A/AAAA records interchangeably during iteration. Validated with --all-nameservers and --iterative. Want to add a table-driven test for all possible values of network options to at least ensure we can return something.
…ipv4-and-ipv6-ns-iterative
…Ses depending on flag
… IP mode. Surface our internal logic of gleaning what mode we should be in
…ebase and use the standard one, a few lints too
…n-demand in the resolver but otherwise this msg is weird to a user with empty local addrs
9f7f872 to
f256dc7
Compare
zakird
approved these changes
May 26, 2026
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.
Description
The concept of "iteration preference" was used when I added
--all-nameservers. We want to discover what nameservers an IP has, and to do so we request theAorAAAArecords for the nameservers. The underlying assumption here was that nameservers are unique by their domain name, and so the IPv4 or IPv6 address of them should be interchangeable.The issue opener wanted to resolve both. To do so, I added a `--all-nameservers-all-ips
Adds a new
--all-nameservers-all-ipsthat:Caveats
no-preference- If a user uses--all-nameserverswithout specifying an iteration preference, by default we'll flip a coin and pick a random one. Of course, if a scanning host only has IPv4 or only IPv6 support, we'll only query for A or AAAA records, respectively.--all-nameservers-all-ipsimplies--all-nameserversOther Improvements
Infologs to help with explainability.And if a user provides a local address:
And if a user provides nameservers
Testing
In
zdns_test.go, I added a very large table-driven test to cover various permutations of options. This helped me discover several bugs in how we handlectx's and timeouts.These skip tests for IP versions the test host doesn't support, ie. on GH runners that lack IPv6, we'll skip any tests with IPv6. For testing we attempt to establish an outbound connection to an IPv4 and IPv6 resolver to test for connectivity before testing.
Happy Path Testing
While the full output is massive, here is a summary of the Cloudflare resolvers queried from a host with IPv6 capability for
dns-testing.com. Note that there's a result for each IP forns-cloud-cN.googledomains.comfor N = 1,2,3,4.Related Issues
Closes #598