Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 19425
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: jtk [...] ultradns.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.57
Fixed in: (no value)



Subject: Unnecessary rd set in Recurse.pm
I'm moving a discussion that initially started with private email to Oalf. This and the following entry will consist of the initial email exchange, the third will then be a new follow-up to Olaf's private reply. -- From: John Kristoff <jtk@ultradns.net> To: olaf@net-dns.org Subject: Unnecessary rd enabled in Recurse.pm? Date: Fri, 12 May 2006 13:41:11 -0500 Hi Olaf, I am trying to use Net::DNS::Resolver::Recurse for a simple tool that walks the tree, but I noticed that no matter what I did my first query was able sent with the recursion desired flag set. This is not what I want. Here is a sample piece of code based largely on the example in the doc: #!/usr/bin/perl -wT use strict; $|=1; use Net::DNS::Resolver::Recurse; my @root_hints = ( "192.5.5.241" ); my $res = Net::DNS::Resolver::Recurse->new; $res->hints(@root_hints); $res->recursion_callback(sub { my $packet = shift; $_->print for $packet->additional; printf(";; Received %d bytes from %s\n\n", $packet->answersize, $packet->answerfrom ); }); my $packet = $res->query_dorecursion( "depaul.edu.", "NS"); In a packet capture I notice the first query towards the root server I gave the hint to will have the recursion desired flag set. Why is this? I noticed in Recurse.pm on line 28 that you set recursion for the query that asks one of the hint servers who it thanks is auth for the root. While it won't generally hurt to have this I guess, I did not want this behavior so I changed it. Can you explain this or is this a bug? I also noticed that if I don't set the hints the TLD will get a query with rd set as well. John
From: jtk [...] ultradns.net
Olaf's reply: From: "Olaf M. Kolkman" <olaf@dacht.net> To: John Kristoff <jtk@ultradns.net> Subject: Re: Unnecessary rd enabled in Recurse.pm? Date: Mon, 22 May 2006 21:02:55 +0200 Hi John, Apologies for not getting back to you earlier. On May 12, 2006, at 8:41 PM, John Kristoff wrote: Show quoted text
> Hi Olaf, > > I am trying to use Net::DNS::Resolver::Recurse for a simple tool that > walks the tree, but I noticed that no matter what I did my first query > was able sent with the recursion desired flag set. This is not what I > want.
(...) Show quoted text
> > In a packet capture I notice the first query towards the root server > I gave the hint to will have the recursion desired flag set. Why is > this? I noticed in Recurse.pm on line 28 that you set recursion for > the query that asks one of the hint servers who it thanks is auth for > the root. While it won't generally hurt to have this I guess, I did > not want this behavior so I changed it. Can you explain this or is > this a bug?
This is not a bug but a feature. The Recursor module does a so called priming query. This is what the initial developer of the module thought was a good thing. I doubt if one should send a query to the root every time one starts resolution (although the result is kept over multiple calls during the lifetime of the object). Anyway you can hack around this by setting the hint attribute appropriately. Note that the attribute is an anonymous hash with the names of the servers as keys and anonymous arrays with their IP addresses as values. Also note that there was a bug in earlier versions that did not handle the recursion at all in earlier versions (e.g. version 0.48 that commes with debian. I have not checked the revision logs when that was fixed). As an alternative: use Net::DNS::Resolver::Recurse; my $res = Net::DNS::Resolver::Recurse->new; $res->debug(1); #Debugging will show the priming. $res->{'hints'}={ "k.root-server.net" => [ qw( 193.0.14.129 ) ], "a.root-server.net" => [ qw( 192.5.5.241 ) ], }; $res->recursion_callback(sub { my $packet = shift; $_->print for $packet->additional; printf(";; Received %d bytes from %s\n\n", $packet->answersize, $packet->answerfrom ); }); my $packet = $res->query_dorecursion( "depaul.edu.", "NS"); Show quoted text
> I also noticed that if I don't set the hints the TLD will get a query > with rd set as well.
This I do not understand. Can you give me an example? Hope this helped. --Olaf PS please use the rt.cpan.org to report bugs and questions. It makes tracking much easier and mail will not be mistaken as spam.
From: jtk [...] ultradns.net
Show quoted text
> Anyway you can hack around this by setting the hint attribute > appropriately. Note that the attribute is an anonymous hash with the > names of the servers as keys and anonymous arrays with their IP > addresses as values.
Aha, I was looking at the "hints" documentation here: <http://www.net-dns.org/docs/Net/DNS/Resolver/Recurse.html> and passing the root hints as an array of IP addresses to res->hints(), but that is not the same thing. Thanks for clarifying this. Show quoted text
> > I also noticed that if I don't set the hints the TLD will get a query > > with rd set as well.
> > This I do not understand. Can you give me an example?
So when I do something like this: $perl -e 'use Net::DNS::Resolver::Recurse; $res = Net::DNS::Resolver::Recurse->new; $packet = $res->query_dorecursion("depaul.edu", 'NS');' The first query goes to a local server for the root NS RRSet, with RD set. This is as expected. Then however, when the next query goes towards a select root server and rd is still set, which is what I thought should be avoided. Thereafter rd is not set. You should be able to verify with a packet trace or by adding in some debug info. John
Subject: Re: [rt.cpan.org #19425] Unnecessary rd set in Recurse.pm
Date: Mon, 22 May 2006 23:34:35 +0200
To: bug-Net-DNS [...] rt.cpan.org
From: "Olaf M. Kolkman" <olaf [...] dacht.net>
Download PGP.sig
application/pgp-signature 227b

Message body not shown because it is not plain text.

Show quoted text
> > So when I do something like this: > > $perl -e 'use Net::DNS::Resolver::Recurse; $res = > Net::DNS::Resolver::Recurse->new; $packet = > $res->query_dorecursion("depaul.edu", 'NS');' > > The first query goes to a local server for the root NS RRSet, with RD > set. This is as expected. Then however, when the next query goes > towards a select root server and rd is still set, which is what I > thought should be avoided. Thereafter rd is not set. You should be > able to verify with a packet trace or by adding in some debug info. >
The root servers do not recurse so the bit does not hurt... but still you have a valid point. Attached is a fixed Recurse.pm Fix also lives on the trunk

Message body is not shown because sender requested not to inline it.

--Olaf ------------------------------------------------------ Ik dacht net... heel even maar.