resolved: when caching replies, check rcode earlier

This way we don't log complaints about packets without SOA in case we are not
caching it anyway because the rcode is not SUCCESS or NXDOMAIN...
This commit is contained in:
Lennart Poettering 2016-06-23 23:36:10 +02:00
parent d001e0a3af
commit 6ff01a0d64
1 changed files with 6 additions and 6 deletions

View File

@ -624,6 +624,12 @@ int dns_cache_put(
dns_cache_remove_previous(c, key, answer);
/* We only care for positive replies and NXDOMAINs, on all
* other replies we will simply flush the respective entries,
* and that's it */
if (!IN_SET(rcode, DNS_RCODE_SUCCESS, DNS_RCODE_NXDOMAIN))
return 0;
if (dns_answer_size(answer) <= 0) {
char key_str[DNS_RESOURCE_KEY_STRING_MAX];
@ -632,12 +638,6 @@ int dns_cache_put(
return 0;
}
/* We only care for positive replies and NXDOMAINs, on all
* other replies we will simply flush the respective entries,
* and that's it */
if (!IN_SET(rcode, DNS_RCODE_SUCCESS, DNS_RCODE_NXDOMAIN))
return 0;
cache_keys = dns_answer_size(answer);
if (key)
cache_keys++;