Subject: | Problem with NS query |
We cannot retrieve NS records with query method when DNS server answer like RFC 1034 precognize (section 4.3.2) when it's a referral.
-- dig command --
; <<>> DiG 9.2.3 <<>> com ns @B.ROOT-SERVERS.NET +norecurse
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6441
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 13
;; QUESTION SECTION:
;com. IN NS
;; AUTHORITY SECTION:
com. 172800 IN NS A.GTLD-SERVERS.NET.
com. 172800 IN NS G.GTLD-SERVERS.NET.
com. 172800 IN NS H.GTLD-SERVERS.NET.
com. 172800 IN NS C.GTLD-SERVERS.NET.
com. 172800 IN NS I.GTLD-SERVERS.NET.
com. 172800 IN NS B.GTLD-SERVERS.NET.
com. 172800 IN NS D.GTLD-SERVERS.NET.
com. 172800 IN NS L.GTLD-SERVERS.NET.
com. 172800 IN NS F.GTLD-SERVERS.NET.
com. 172800 IN NS J.GTLD-SERVERS.NET.
com. 172800 IN NS K.GTLD-SERVERS.NET.
com. 172800 IN NS E.GTLD-SERVERS.NET.
com. 172800 IN NS M.GTLD-SERVERS.NET.
;; ADDITIONAL SECTION:
A.GTLD-SERVERS.NET. 172800 IN A 192.5.6.30
G.GTLD-SERVERS.NET. 172800 IN A 192.42.93.30
H.GTLD-SERVERS.NET. 172800 IN A 192.54.112.30
C.GTLD-SERVERS.NET. 172800 IN A 192.26.92.30
I.GTLD-SERVERS.NET. 172800 IN A 192.43.172.30
B.GTLD-SERVERS.NET. 172800 IN A 192.33.14.30
D.GTLD-SERVERS.NET. 172800 IN A 192.31.80.30
L.GTLD-SERVERS.NET. 172800 IN A 192.41.162.30
F.GTLD-SERVERS.NET. 172800 IN A 192.35.51.30
J.GTLD-SERVERS.NET. 172800 IN A 192.48.79.30
K.GTLD-SERVERS.NET. 172800 IN A 192.52.178.30
E.GTLD-SERVERS.NET. 172800 IN A 192.12.94.30
M.GTLD-SERVERS.NET. 172800 IN A 192.55.83.30
;; Query time: 212 msec
;; SERVER: 192.228.79.201#53(B.ROOT-SERVERS.NET)
;; WHEN: Fri Feb 20 19:44:32 2004
;; MSG SIZE rcvd: 453
--- end dig command --
As you can see NS answer are in the Authority section. So when I use Net::DNS::Resolver::query, it return undef, but it's an answer. It should return a Net::DNS::Packet and I could get Authority section.
If I should use another way, you must better include this in your documentation.
If you need another information contact me.
-----
Distribution name and version : Net-DNS-0.45
Perl version : 5.6.1 / 5.8.2
perating System vendor and version: Linux <computer name> 2.4.20-13.7custom #2 <date> i686 unknown / Linux <computer name> 2.4.24 #1 <date> i686 GNU/Linux
--
Code example :
use strict;
use Net::DNS;
my $res = Net::DNS::Resolver->new;
$res->defnames(0);
$res->dnsrch(0);
$res->recurse(0);
$res->nameservers("B.ROOT-SERVERS.NET");
my $packet = $res->query("com", "NS");
if( !defined($packet) )
{
warn "possible bug in Net::DNS\n";
}
else
{
$packet->print;
}