Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: Mark.Martinec [...] ijs.si
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.69
Fixed in: (no value)



Subject: NXDOMAIN is no longer reported by $r->errorstring
Net::DNS 0.69 (and 0.70) no longer return error in errorstring() in case the Net::DNS::Resolver::query() comes back empty-handed (non-existent domain, packet is returned with no answer section, header->rcode is NXDOMAIN): $ perl -le 'use Net::DNS; $r=Net::DNS::Resolver->new; $resp=$r->query("_adsp._domainkey.xxx.sa-test.spamassassin.org"); printf("resp=%s, errstr=/%s/\n", defined $resp ? $resp : "UNDEF", $r->errorstring)' 0.69, 0.70 -(incorrect): resp=UNDEF, errstr=// 0.68 - (correct): resp=UNDEF, errstr=/NXDOMAIN/ (btw, this breaks Mail::DKIM handling of ADSP for non-existent domains)
From: rwfranks [...] acm.org
On Fri Dec 07 20:21:26 2012, Mark.Martinec@ijs.si wrote: Show quoted text
> Net::DNS 0.69 (and 0.70) no longer return error in errorstring() > in case the Net::DNS::Resolver::query() comes back empty-handed > (non-existent domain, packet is returned with no answer section, > header->rcode is NXDOMAIN): > > $ perl -le 'use Net::DNS; $r=Net::DNS::Resolver->new; > $resp=$r->query("_adsp._domainkey.xxx.sa-test.spamassassin.org"); > printf("resp=%s, errstr=/%s/\n", > defined $resp ? $resp : "UNDEF", $r->errorstring)' > > 0.69, 0.70 -(incorrect): > resp=UNDEF, errstr=// > > 0.68 - (correct): > resp=UNDEF, errstr=/NXDOMAIN/ > > (btw, this breaks Mail::DKIM handling of ADSP for non-existent domains)
errorstring() is not intended to be a substitute for header->rcode. It only contains the RCODE if the resolver completed the retry sequence for all nameservers, as the only evidence it has which might identify the error. A query which returns NXDOMAIN is a proper response which indicates that there is no RR with the specified name. This is not an error. errorstring() is used to report exceptions and error conditions which prevent proper functioning of the resolver itself.
From: Mark.Martinec [...] ijs.si
Show quoted text
> errorstring() is not intended to be a substitute for header->rcode. > It only contains the RCODE if the resolver completed the retry > sequence for all nameservers, as the only evidence it has which > might identify the error. > A query which returns NXDOMAIN is a proper response which indicates > that there is no RR with the specified name. This is not an error.
That would make sense when used with a send() method, which does return a 'header' object and $r->header->rcode can be examined. But when query() is used, it returns undef when there are no answer sections, so rcode can't be examined. The query() method is to be used like: $r->query(...) or die "Can't do it: ".$r->errorstring I suppose.
From: rwfranks [...] acm.org
On Sat Dec 08 10:08:34 2012, Mark.Martinec@ijs.si wrote: Show quoted text
> But when query() is used, it returns undef when there are no answer > sections, so rcode can't be examined. The query() method is to be > used like: $r->query(...) or die "Can't do it: ".$r->errorstring > I suppose.
I get the picture. If I can put it back, I will, but you must not expect always to get an RCODE mnemonic. errorstring() will return other forms of bad news if the resolver trips over bad data or OS problems outside its control.
From: Mark.Martinec [...] ijs.si
Show quoted text
> I get the picture. > If I can put it back, I will, but you must not expect always to get an > RCODE mnemonic. errorstring() will return other forms of bad news > if the resolver trips over bad data or OS problems outside its control
Thank you! Replacing query() by send() was already discussed for the Mail::DKIM project for other reasons and will probably materialize in the next release, this incompatibility adds another incentive for the transition and for more concise DNS error results handling.
Patch committed in trunk and it will be in 0.71.