Skip to content
  • Witold Kręcicki's avatar
    Set result to SERVFAIL if upstream responded with FORMERR · b5c9a8ca
    Witold Kręcicki authored and Michał Kępień's avatar Michał Kępień committed
    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