Skip Menu |

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

Report information
The Basics
Id: 36054
Status: rejected
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: rfg [...] tristatelogic.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Enhancement Request (findzonecut)
Date: Tue, 20 May 2008 13:05:12 -0700
To: bug-Net-DNS [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
Thanks for the wonderful software! (The price is right too!) For an important project I'm working on, I rather desperately need to have the functionaity provided by the C language 'res_findzonecut' function (part of the BIND resolver library) but I need to have it in Perl, e.g. as yet another method available to users of the Net::DNS::Resolver class. If there is any chance at all that you would be willing to add a new 'findzonecut' method to the existing Net::DNS::Resolver class, then I would be eternally grateful. Thank you for your consideration. Regards, rfg
1. Zone walking and finding zone cuts is frowned upon by some DNS specialists. It is putting unneeded load on the infrastructure. Therefore I am hesitant to provide a method that eases this behavior. 2. On the other hand using the wire2presentation and name2labels utilities (undocumented) which are for internal consumption in Net::DNS this is all fairly trivial. See the example script below that takes a domain name as an argument. Will print each SOA and the NS records above (parent) and below (child) the zonecut . Apologies for not getting back earlier; closing the ticket #!/usr/bin/perl -Wall use strict; use Net::DNS qw (wire2presentation name2labels); my @labels=name2labels(shift); my $resolver=Net::DNS::Resolver->new; my $parental_lookup=""; while (@labels) { my $name=compose_name(@labels); if ($parental_lookup){ my $pckt=$resolver->send($parental_lookup,"NS"); if ($pckt->header->ancount){ print_ns_a("Parent", $pckt->answer); $parental_lookup=0; } } my $pckt=$resolver->send($name,"SOA"); if ($pckt->header->ancount){ print "-----\nFOUND SOA @ $name" if ($pckt->answer)[0]->type eq "SOA"; undef($pckt); $pckt=$resolver->send($name,"NS"); if ($pckt->header->ancount){ print_ns_a("Child ", $pckt->answer); $parental_lookup=$name; } } shift @labels; } sub compose_name { my $name; foreach my $label (@_){ $name .= wire2presentation($label) . "."; } return $name; } sub print_ns_a { my $caption=shift; foreach my $ns (@_){ next unless $ns->type eq "NS"; my $apckt=$resolver->send($ns->nsdname,"A"); if ($apckt->header->ancount){ foreach my $a ($apckt->answer){ print $caption." NS ".$ns->nsdname. " : ".$a->address; } }else{ print "No A RRs found for ". $ns->nsdname; } } }
PS.. adding that script to the contrib dir.
PS.. adding that script to the contrib dir.
PS.. adding that script to the contrib dir.
Subject: Re: [rt.cpan.org #36054] Enhancement Request (findzonecut)
Date: Wed, 17 Dec 2008 13:07:45 -0800
To: bug-Net-DNS [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
In message <rt-3.6.HEAD-19694-1229521356-100.36054-6-0@rt.cpan.org>, you wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=36054 > > > > >1. Zone walking and finding zone cuts is frowned upon by some DNS specialists. > It is putting >unneeded load on the infrastructure. Therefore I am hesitant to provide a meth >od that eases >this behavior.
While you may be correct that ``heavy'' use of zonecutting is frowned upon, in some quarters, I don't think that's the most important issue. The bottom line is that this functionality _is_ provided in the C version of the resolver library, some people, such as myself, know how to make judicious and non-stressful use of the functionality, and I think that the corresponding Perl library (Net::DNS) is remiss if it fails to export the same functionality as the C library. That sort of limitation just feeds critics of Perl who say that its not as useful, flexible, or powerful as C. Further, the value judgement you are making is apparently not shared by the folks who wrote and maintain the C resolver library. Show quoted text
>2. On the other hand using the wire2presentation and name2labels utilities (un >documented) >which are for internal consumption in Net::DNS this is all fairly trivial. See > the example script >below that takes a domain name as an argument. Will print each SOA and the NS >records >above (parent) and below (child) the zonecut .
Thank you for the script. Show quoted text
>Apologies for not getting back earlier; closing the ticket
That's OK. Apology accepted. Thank you for Net::DNS. I find it most useful.
Let me keep the ticket stalled, as wish-list. There are some other issues to work on and I want to try and do a release before the end of year.
Let me keep the ticket stalled, as wish-list. There are some other issues to work on and I want to try and do a release before the end of year.
Subject: Re: [rt.cpan.org #36054] Enhancement Request (findzonecut)
Date: Wed, 17 Dec 2008 21:33:08 -0800
To: bug-Net-DNS [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
In message <rt-3.6.HEAD-19694-1229556329-114.36054-6-0@rt.cpan.org>, you wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=36054 > > >Let me keep the ticket stalled, as wish-list. There are some other issues to w >ork on and I want >to try and do a release before the end of year. >
Perfectly fine by me.
From: rwfranks [...] acm.org
On Wed Dec 17 16:08:00 2008, rfg@tristatelogic.com wrote: Show quoted text
> Perl library (Net::DNS) is remiss if it fails to export the same > functionality as the C library.
Net::DNS is not an attempt to translate the C library into Perl. Show quoted text
> > 2. On the other hand using the wire2presentation and name2labels > > utilities (un > > documented) > > which are for internal consumption in Net::DNS this is all fairly > > trivial. See > > the example script > > below that takes a domain name as an argument. Will print each SOA > > and the NS > > records > > above (parent) and below (child) the zonecut .
> > Thank you for the script. >
The script used name2labels() and wire2presentation() which are no longer used in Net::DNS. These will be removed in a future release. DNS name resolution by a stub resolver requires no knowledge of where zonecuts occur in the DNS hierarchy. Few applications require such knowledge, therefore there is little justification for including this function in the general package. Finding the closest zonecut to a DNS name can be achieved using two lines of code and imposing negligible stress on DNS infrastructure: $reply = $resolver->send( "*.$name", 'NULL' ); ($cut) = map $_->name, $reply->authority; A sample script (find_zonecut) using this technique has been added to the contrib sub-directory of the distribution.