Subject: | bgsend/bgread does not work correctly with long DNSKEY replys |
Date: | Thu, 13 Dec 2012 17:28:14 +0400 |
To: | bug-Net-DNS [...] rt.cpan.org |
From: | Nikolay Shaplov <dhyan [...] nataraj.su> |
It seems to me that I've found a bug with background request when used with
massive DNSSEC data.
It does not returns all records that were replayed by server.
For now in org zone there are four DNSKEYs, if they finished a rotation change
an example to a zone that has four keys in it.
=========
my $server = 'a0.org.afilias-nst.info';
my $host = 'org';
while (1)
{
print scalar(dig_normal()),"\t", scalar(dig_bg()),"\n";
}
sub dig_normal
{
my $res = Net::DNS::Resolver->new(nameservers=>[$server], usevc=>0);
my $packet = $res->send($host,'DNSKEY');
return $packet->answer;
}
sub dig_bg
{
my $res = Net::DNS::Resolver->new(nameservers=>[$server]);
my $req = $res->bgsend($host,'DNSKEY');
my $count =0;
my $packet;
while ($count++<10)
{
if ($res->bgisready($req))
{
$packet = $res->bgread($req);
last;
}
sleep 1;
}
return $packet->answer;
}
For me this example prints
4 1
4 1
4 0
4 2
4 0
4 2
4 2
4 1
4 2
4 1
4 2
4 0
The first number is a number of DNSKEY records obtained by normal request, and
a second one is number of records returned by background request. Adding a
sleep before bgread does not help.
I am using last version of IO and last stable version of Net::DNS.