Skip Menu |

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

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

People
Owner: OLAF [...] cpan.org
Requestors: OLAF [...] cpan.org
Cc: jmora [...] nic.mx
AdminCc:

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



CC: jmora [...] nic.mx
Subject: No packet returned with delegation.
=============SNIPPET============== our $resolverAdress1 = "200.23.1.1"; our $resolverAdress2 = "ads.nic.com.mx"; my $resolver1 = Net::DNS::Resolver->new( nameservers => [$resolverAdress1], recurse => 0, debug => 0, ); my $resolver2 = Net::DNS::Resolver->new( nameservers => [$resolverAdress2], recurse => 1, debug => 0, ); my $packet1 = $resolver1->query("${block}.$zone", "NS"); my $packet2 = $resolver2->query("${block}.$zone", "NS"); if ($packet1) { print "->Resolver1: Query OK\n"; } else { print "->Resolver1: Query failed: ", $resolver1->errorstring, "\n"; } if ($packet2) { print "->Resolver1: Query OK\n"; } else { print "->Resolver2: Query failed: ", $resolver2->errorstring, "\n"; } =============SNIPPET END========== The first server, our primary server, (the one who has all the inverse zones registered and transfer to the another) 200.23.1.1 was not answering, while the second in fact does. I then dig to both. dig @200.23.1.1 30.248.207.in-addr.arpa. NS ; <<>> DiG 9.2.5 <<>> @200.23.1.1 30.248.207.in-addr.arpa. NS ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 470 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 2 ;; QUESTION SECTION: ;30.248.207.in-addr.arpa. IN NS ;; AUTHORITY SECTION: 30.248.207.in-addr.arpa. 86400 IN NS dns1.infosel.net.mx. 30.248.207.in-addr.arpa. 86400 IN NS dns2.infosel.net.mx. ;; ADDITIONAL SECTION: dns1.infosel.net.mx. 86400 IN A 148.246.247.124 dns2.infosel.net.mx. 86400 IN A 148.246.247.126 ;; Query time: 78 msec ;; SERVER: 200.23.1.1#53(200.23.1.1) ;; WHEN: Tue Jun 26 13:13:09 2007 dig @ads.nic.com.mx 30.248.207.in-addr.arpa. NS ; <<>> DiG 9.2.5 <<>> @ads.nic.com.mx 30.248.207.in-addr.arpa. NS ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 643 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;30.248.207.in-addr.arpa. IN NS ;; ANSWER SECTION: 30.248.207.in-addr.arpa. 10800 IN NS dns1.infosel.net.mx. 30.248.207.in-addr.arpa. 10800 IN NS dns2.infosel.net.mx. ;; Query time: 203 msec ;; SERVER: 172.17.33.15#53(172.17.33.15) ;; WHEN: Tue Jun 26 13:17:32 2007 ;; MSG SIZE rcvd: 112 As you notice both answers it's the same, just the first is in the authority section, and the second in the answer section. But that was what I was looking out for, After a little research in the Net::DNS code I found this in the Base.pm (Version 0.59, but it's the same on 0.60) of the resolver: return $packet if $packet->header->ancount; # answer found What i really needed was return $packet if ($packet->header->rcode eq "NOERROR");
RT-Send-CC: jmora [...] nic.mx
Doohhh... Turns out that this is not a bug but an old feature of Net::DNS. When you use the search or query mechanism you will only get an answer if there is anything in the answer section of the packet. (By design). If you want to always get an answer then you should use the send() method. To my shame I forgot that this is a documented feature: perldoc Net::DNS::Reslover search() (...) 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.