resolved: cache - improve logging

Some DNS servers will hand out negative answers without SOA records,
these can not be cached, so log about that fact.
This commit is contained in:
Tom Gundersen 2015-12-03 21:26:19 +01:00
parent 71e136699c
commit c3cb6dc20b

View file

@ -443,8 +443,17 @@ int dns_cache_put(
dns_cache_remove(c, key);
}
if (!answer)
if (!answer) {
_cleanup_free_ char *key_str = NULL;
r = dns_resource_key_to_string(key, &key_str);
if (r < 0)
return r;
log_debug("Not caching negative entry without a SOA record: %s", key_str);
return 0;
}
for (i = 0; i < answer->n_rrs; i++)
dns_cache_remove(c, answer->items[i].rr->key);