Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability for user to select root servers for iterative mode #412

Merged
merged 9 commits into from
Aug 7, 2024

Conversation

phillip-stephens
Copy link
Contributor

Description

A user may want to select a set of root name servers other than the full 13 . roots, either to only use one root or to test against a different server. This PR adds that.

Testing

When selecting a root server, ZDNS uses it

$ echo "cloudflare.com" | ./zdns A --iterative --name-servers="198.41.0.4" --verbosity=5

INFO[0000] using local addresses: [192.168.1.243]       
INFO[0000] for non-iterative lookups, using external nameservers: 198.41.0.4:53 
INFO[0000] for iterative lookups, using nameservers: 198.41.0.4:53 
DEBU[0000] DEPTH 00:[MIEKG-IN: starting a C/DNAME following lookup for  cloudflare.com  ( 1 )] 
DEBU[0000] DEPTH 01:    [MIEKG-IN: following iterative lookup for  cloudflare.com  ( 1 )] 
DEBU[0000] DEPTH 01:    [iterative lookup for  cloudflare.com  ( 1 ) against  198.41.0.4:53  layer  .] 
DEBU[0000] DEPTH 02:        [Cached retrying lookup. Name:  {1 1 cloudflare.com} , Layer:  . , Nameserver:  198.41.0.4:53] 
DEBU[0000] DEPTH 03:            [Cache request for:  cloudflare.com  ( 1 )] 

Notice how we start the lookup against the 1 root provided.

Normal usage isn't broken

$ echo "cloudflare.com" | ./zdns A --iterative --verbosity=5

INFO[0000] using local addresses: [192.168.1.243]       
INFO[0000] for non-iterative lookups, using external nameservers: 192.168.1.1:53 
INFO[0000] for iterative lookups, using nameservers: 198.41.0.4:53, 170.247.170.2:53, 192.33.4.12:53, 199.7.91.13:53, 192.203.230.10:53, 192.5.5.241:53, 192.112.36.4:53, 198.97.190.53:53, 192.36.148.17:53, 192.58.128.30:53, 193.0.14.129:53, 199.7.83.42:53, 202.12.27.33:53 
DEBU[0000] DEPTH 00:[MIEKG-IN: starting a C/DNAME following lookup for  cloudflare.com  ( 1 )] 
DEBU[0000] DEPTH 01:    [MIEKG-IN: following iterative lookup for  cloudflare.com  ( 1 )] 
DEBU[0000] DEPTH 01:    [iterative lookup for  cloudflare.com  ( 1 ) against  202.12.27.33:53  layer  .] 
DEBU[0000] DEPTH 02:        [Cached retrying lookup. Name:  {1 1 cloudflare.com} , Layer:  . , Nameserver:  202.12.27.33:53] 

@phillip-stephens phillip-stephens marked this pull request as ready for review August 2, 2024 14:14
@phillip-stephens phillip-stephens requested a review from a team as a code owner August 2, 2024 14:14
@@ -75,6 +75,7 @@ func populateNetworkingConfig(gc *CLIConf) error {
log.Info("using local interface: ", gc.LocalIfaceString)
}

// TODO this now needs re-work
Copy link
Member

@zakird zakird Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need resolution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch, looked back over this and yeah this needed addressing.

In the case that there was a loopback NS in /etc/resolv.conf, without the check added in a2ada2c, ZDNS would over-write the nameservers.

Added a guard and tested by setting my local /etc/resolv.conf to loopback. The old code overwrites the nameservers, with the guard added we don't and it performs as expected.

@phillip-stephens phillip-stephens merged commit ec77b66 into main Aug 7, 2024
3 checks passed
@phillip-stephens phillip-stephens deleted the phillip/improved-root-ns-handling branch August 7, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants