Subject: | errorstring doesn't report error detail |
Consider the example used for Net::DNS::Reslover::axfr:
$resolver->tsig( 'Khmac-sha1.example.+161+24053.private' );
@zone = $resolver->axfr( 'example.com' );
die 'Zone transfer failed: ', $resolver->errorstring unless @zone;
Set system time of a client to the day before that of the server, and execute with a valid key and domain.
Result will be:
Zone transfer failed: RCODE from server: NOTAUTH
This is the RCODE from the message header. It should reflect the Error field from the TSIG record [when non-zero], which is more specific (and more useful). E.g.
Zone transfer failed: RCODE from server: BADTIME
(Or perhaps "NOTAUTH (BADTIME)" for the pedantic.)
The detailed error should be returned for all query types, not just axfr. (E.g. signed query())
Since this is a long-standing behavior, it may be advisable to make errorstring() return detailed error status conditionally - e.g. $res->errorstring(1).... This would avoid breaking any existing consumers.
Note that (extended) errorstring should reflect the EXTENDED-RCODE if an OPT record is present in the response.
When multiple error fields are present, the most severe should be returned.
In general, this will be:
TSIG Error (no processing happens in the server if TSIG fails) ||
OPT EXTENDED-RCODE (from 'TTL' MSB) << 4 | Message Header RCODE ||
Message Header RCODE