Skip Menu |

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

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

People
Owner: rt-cpan [...] triv.org
Requestors: simon [...] josefsson.org
Cc:
AdminCc:

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



Subject: Net::DNS::Resolver->query when ancount = 0 return undef Net::DNS::Packet?
Hello. This problem might be due to poor understanding of Net::DNS on my part, but I'd appreciate if you would take a look. The attached script queries for (00800inkjets.se, IN, NS) and receive an answer with an empty ANSWER section, but with some information in the AUTHORITY section. However, Net::DNS doesn't seem to like the response, and just return 'undef', so I can't look at the packet. If you need any more information, I will try to get it. Thank you. Script: #!/usr/bin/perl use strict; use Net::DNS; my $res = Net::DNS::Resolver->new; $res->nameservers("dnssec.nic-se.se"); $res->debug(1); print "Net::DNS version ", $Net::DNS::VERSION, "\n"; my $query = $res->query("00800inkjets.se", "NS"); if ($query eq undef) { die "Query failed?!"; } print "Ok\n"; Output: Net::DNS version 0.46 ;; query(00800inkjets.se, NS, IN) ;; send_udp(212.247.3.66:53) ;; answer from 212.247.3.66:53 : 80 bytes ;; HEADER SECTION ;; id = 17496 ;; qr = 1 opcode = QUERY aa = 0 tc = 0 rd = 1 ;; ra = 0 ad = 0 cd = 0 rcode = NOERROR ;; qdcount = 1 ancount = 0 nscount = 2 arcount = 0 ;; QUESTION SECTION (1 record) ;; 00800inkjets.se. IN NS ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (2 records) 00800inkjets.se. 3600 IN NS ns1.eurodns.com. 00800inkjets.se. 3600 IN NS ns2.eurodns.com. ;; ADDITIONAL SECTION (0 records) Query failed?! at ./nsec.pl line 11.
Date: Wed, 2 Jun 2004 06:53:05 -0600
From: Michael Fuhr <mike [...] fuhr.org>
To: Guest via RT <bug-Net-DNS [...] rt.cpan.org>
Subject: Re: [cpan #6477] Net::DNS::Resolver->query when ancount = 0 return undef Net::DNS::Packet?
RT-Send-Cc:
On Wed, Jun 02, 2004 at 07:38:48AM -0400, Guest via RT wrote: Show quoted text
> > This message about Net-DNS was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=6477 > > > Hello. This problem might be due to poor understanding of Net::DNS > on my part, but I'd appreciate if you would take a look. The attached > script queries for (00800inkjets.se, IN, NS) and receive an answer with an > empty ANSWER section, but with some information in the AUTHORITY section. > However, Net::DNS doesn't seem to like the response, and just return > 'undef', so I can't look at the packet. If you need any more information, > I will try to get it. Thank you.
As the Net::DNS::Resolver manual page points out, the "query" method returns undef if the response packet contains no answers. If you want to examine the response whether it contains answers or not, then use the "send" method. -- Michael Fuhr http://www.fuhr.org/~mfuhr/