Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: douzzer [...] mega.nu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.66
Fixed in: (no value)



Net::DNS::Resolver::Base::query() fails (returns undef) if there are no RR's in the answer section. This is a serious problem, because authoritative servers (BIND 9, at least) return delegations (NS, DS, RRSIG) entirely in the authority section and return an empty answer section. (The additional section may of course have RRs.) I found that doing this at line 464 in Base.pm DTRT: if ($packet->header->ancount || $packet->header->nscount) { return $packet; } else { return undef; } At line 442, I also made this substitution: return $packet if ($packet->header->ancount || $packet->header->nscount); # answer found
From: rwfranks [...] acm.org
On Wed Apr 14 04:51:05 2010, douzzer wrote: Show quoted text
> Net::DNS::Resolver::Base::query() fails (returns undef) if there are
no RR's in the answer section. This is expected and well-documented behaviour, NOT a bug. Run perldoc Net::DNS::Resolver to see the following explanation and advice. --Dick query $packet = $res->query('mailhost'); $packet = $res->query('mailhost.example.com'); $packet = $res->query('192.168.1.1'); $packet = $res->query('example.com', 'MX'); $packet = $res->query('user.passwd.example.com', 'TXT', 'HS'); Performs a DNS query for the given name; the search list is not applied. If the name doesn’t contain any dots and defnames is true then the default domain will be appended. The record type and class can be omitted; they default to A and IN. If the name looks like an IP address (IPv4 or IPv6), then an appropriate PTR query will be performed. Returns a "Net::DNS::Packet" object, or "undef" if no answers were found. If you need to examine the response packet whether it contains any answers or not, use the send() method instead. send $packet = $res->send($packet_object); $packet = $res->send('mailhost.example.com'); $packet = $res->send('example.com', 'MX'); $packet = $res->send('user.passwd.example.com', 'TXT', 'HS'); Performs a DNS query for the given name. Neither the searchlist nor the default domain will be appended.
Hi douzzer, As Dick mentions this is the correct behaviour, and send should be used if you wish to inspect the other packet data. Regards, Willem On Wed Apr 14 14:19:26 2010, rwfranks@acm.org wrote: Show quoted text
> On Wed Apr 14 04:51:05 2010, douzzer wrote:
> > Net::DNS::Resolver::Base::query() fails (returns undef) if there are
> no RR's in the answer section. > > > This is expected and well-documented behaviour, NOT a bug. > Run perldoc Net::DNS::Resolver to see the following explanation and
advice. Show quoted text
> > --Dick > > > query > > $packet = $res->query('mailhost'); > $packet = $res->query('mailhost.example.com'); > $packet = $res->query('192.168.1.1'); > $packet = $res->query('example.com', 'MX'); > $packet = $res->query('user.passwd.example.com', 'TXT', 'HS'); > > Performs a DNS query for the given name; the search list is not > applied. If the name doesn’t contain any dots and > defnames is true then the default domain will be appended. > > The record type and class can be omitted; they default to A and IN. > If the name looks like an IP address (IPv4 or > IPv6), then an appropriate PTR query will be performed. > > Returns a "Net::DNS::Packet" object, or "undef" if no answers were > found. If you need to examine the response packet > whether it contains any answers or not, use the send() method instead. > > > send > > $packet = $res->send($packet_object); > $packet = $res->send('mailhost.example.com'); > $packet = $res->send('example.com', 'MX'); > $packet = $res->send('user.passwd.example.com', 'TXT', 'HS'); > > Performs a DNS query for the given name. Neither the searchlist nor > the default domain will be appended. > >