MINOR: dns: New DNS response analysis code: DNS_RESP_TRUNCATED

This patch introduces a new internal response state about the analysis
of a DNS response received by a server.
It is dedicated to report to above layer that the response is
'truncated'.
This commit is contained in:
Baptiste Assmann 2015-09-02 21:58:32 +02:00 committed by Willy Tarreau
parent 6cdea9359b
commit 0df5d9669a
3 changed files with 6 additions and 0 deletions

View File

@ -198,6 +198,7 @@ enum {
DNS_RESP_WRONG_NAME, /* response does not match query name */
DNS_RESP_CNAME_ERROR, /* error when resolving a CNAME in an atomic response */
DNS_RESP_TIMEOUT, /* DNS server has not answered in time */
DNS_RESP_TRUNCATED, /* DNS response is truncated */
};
/* return codes after searching an IP in a DNS response buffer, using a family preference */

View File

@ -218,6 +218,10 @@ void dns_resolve_recv(struct dgram_conn *dgram)
resolution->requester_error_cb(resolution, DNS_RESP_CNAME_ERROR);
continue;
case DNS_RESP_TRUNCATED:
nameserver->counters.truncated += 1;
resolution->requester_error_cb(resolution, DNS_RESP_TRUNCATED);
continue;
}
nameserver->counters.valid += 1;

View File

@ -2132,6 +2132,7 @@ int snr_resolution_error_cb(struct dns_resolution *resolution, int error_code)
break;
case DNS_RESP_ANCOUNT_ZERO:
case DNS_RESP_TRUNCATED:
case DNS_RESP_ERROR:
if (resolution->query_type == DNS_RTYPE_ANY) {
/* let's change the query type */