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:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user