[net-dns-users] Fwd: Re: With 1.05 on OS X I'm not seeing errorstring on queries

Doug Barton dougb at dougbarton.us
Tue Apr 12 21:13:43 UTC 2016


The AXFR code works, it always has. I copied it directly from a working script. I added the code you suggested to my demo script and it gave the expected result. 

You are correct that in the past the string that the errorstring method returned for a successful AXFR result contained "no error," not the actual RCODE. I was able to change my script to deal with either string. But that's not the thing I'm actually asking about. :)

Prior to the current version (I haven't been keeping track, but from what you've written it seems like maybe the change was made in 1.04) the errorstring method always contained something when used for queries. If I run my demo script on my Ubuntu system I get the following results:
Perl Version: v5.20.2
Net::DNS Version: 0.81

	Testing AXFR
17636 RRs in zone
Query status for AXFR (Should be NOERROR): unknown error or no errorThen for the queries I get this for all 3 methods:
Query status for method search: (Should be NXDOMAIN): NXDOMAIN

In my previously working script I also have tests such as:

	 if ($res->errorstring eq 'query timed out') {
 } elsif ($res->errorstring eq 'connection failed') {
 } elsif ($res->errorstring =~ /NXDOMAIN/i) {
 } elsif (not $res->errorstring eq 'NOERROR') {(and please keep in mind that I've been using this script, largely unchanged, for over a decade).

So I see two problems here. The first, less serious problem, is that you've changed the semantic for how errorstring is constructed for AXFRs. I can chalk that up to having to keep things up to date as libraries change over time. That doesn't mean I like it, or that I think it's Ok, but it's something I can live with. 

The far more serious problem is that the errorstring method has been gutted altogether for queries. For my purpose I need to know what happened to my query, not just the results. Of course I can use Net::DNS::Header for this, and I'll re-write my code accordingly. But should I have to? Dramatically changing the way that this method works with no notice to the community is not good software engineering. 

(It's probably worth mentioning that there is another problem, namely that the changes to the errorstring method were not listed in the CHANGES file.)

If you're wondering why platforms like Debian are staying with such old versions of Net::DNS, this kind of thing is why. 

My proposal is to simply restore the previous semantics that the errorstring method was using. I don't see any good reason to change them, but I'm willing to listen to an argument in that regard. That said, I think you're on the right track with the change that was made to the errorstring for the axfr method. Rather than such a verbose message however I'd suggest that instead you just append "RCODE: " to whatever the errorstring method was previously returning. For the example in my demo script you'd get "RCODE: NOERROR." That way if a user needs the RCODE value it's available, even if they use the search or query methods (since you can't get the header without using send). For cases where previously the errorstring was returning just the RCODE (such as the search/query/send methods in the case of NXDOMAIN) it should continue to return just that of course. That is, I'd like to maintain consistency with whatever it was returning previously, and only append the RCODE string as above when the previous errorstring did not contain it.

Doug

-------- Forwarded message -------
From: "Dick Franks" 
To: net-dns-users at nlnetlabs.nl (mailto:net-dns-users at nlnetlabs.nl)
Sent: April 12 2016 11:10 AM
Subject: Re: [net-dns-users] With 1.05 on OS X I'm not seeing errorstring on queries
Dealing with each case as a separate issue.

First, modify your AXFR example so we know for certain that it works:

 use Net::DNS;

 print "Perl Version: $^Vn";
 print "Net::DNS Version: ", Net::DNS->version, "n";

 print "nTesting AXFRn";
 my $axfr_res = Net::DNS::Resolver->new or die "Instantiation failed: $!";
 $axfr_res->nameservers("192.5.5.241");
 my @rr_list = $axfr_res->axfr('.') or die "AXFR failed: $!";

 print scalar(@rr_list), " RRs in zonen";
 print "errorstring: ", $axfr_res->errorstring, "n";
 exit;

 Armed with the result we should be able to answer three questions:

 Perl Version: v5.22.1
 Net::DNS Version: 1.05

 Testing AXFR
 17636 RRs in zone
 errorstring: RCODE from server: NOERROR
 1) Was there an error?
Clearly not.
2) Is $res->errorstring defined?
Yes
 3) Did it ever contain just "NOERROR"?
To answer that we need to look back into history.

 Perl Version: v5.22.1
 Net::DNS Version: 0.25 (Aug 2002)

 Testing AXFR
 17636 RRs in zone
 errorstring: no zone transfer in progress
 Perl Version: v5.22.1
 Net::DNS Version: 0.43 (Dec 2003)

 Testing AXFR
 17636 RRs in zone
 errorstring: unknown error or no error
 Perl Version: v5.22.1
 Net::DNS Version: 1.03 (Nov 2015)

 Testing AXFR
 17636 RRs in zone
 errorstring: unknown error or no error
The default text indicates that no attempt was made to put anything in errorstring before version 1.04.
The answer seems to be "No"
As there was no error, I may consider reversing my decision at 1.04 and to leave errorstring empty.
Dick Franks
________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/net-dns-users/attachments/20160412/a16cf02e/attachment.htm>


More information about the net-dns-users mailing list