-
Commit ba912435 causes the resolver to respond to a client query with FORMERR when all upstream queries sent to the servers authoritative for QNAME elicit FORMERR responses. This happens because resolver code returns DNS_R_FORMERR in such a case and dns_result_torcode() acts as a pass-through for all arguments which are already a valid RCODE. The correct RCODE to set in the response returned to the client in the case described above is SERVFAIL. Make sure this happens by overriding the RCODE in query_gotanswer(), on the grounds that any format errors in the client query itself should be caught long before execution reaches that point. This change should not reduce query error logging accuracy as the resolver code itself reports the exact reason for returning a DNS_R_FORMERR result using log_formerr().
b5c9a8ca