mirror of
https://github.com/systemd/systemd.git
synced 2024-12-17 06:03:35 +08:00
resolved: bypass local cache when we issue a transaction for verification purposes
This commit is contained in:
parent
cd1b20f90a
commit
4d926a69bc
@ -465,24 +465,29 @@ int dns_transaction_go(DnsTransaction *t) {
|
|||||||
t->cached = dns_answer_unref(t->cached);
|
t->cached = dns_answer_unref(t->cached);
|
||||||
t->cached_rcode = 0;
|
t->cached_rcode = 0;
|
||||||
|
|
||||||
/* Before trying the cache, let's make sure we figured out a
|
/* Check the cache, but only if this transaction is not used
|
||||||
* server to use. Should this cause a change of server this
|
* for probing or verifying a zone item. */
|
||||||
* might flush the cache. */
|
if (set_isempty(t->zone_items)) {
|
||||||
dns_scope_get_dns_server(t->scope);
|
|
||||||
|
|
||||||
/* Let's then prune all outdated entries */
|
/* Before trying the cache, let's make sure we figured out a
|
||||||
dns_cache_prune(&t->scope->cache);
|
* server to use. Should this cause a change of server this
|
||||||
|
* might flush the cache. */
|
||||||
|
dns_scope_get_dns_server(t->scope);
|
||||||
|
|
||||||
r = dns_cache_lookup(&t->scope->cache, t->question, &t->cached_rcode, &t->cached);
|
/* Let's then prune all outdated entries */
|
||||||
if (r < 0)
|
dns_cache_prune(&t->scope->cache);
|
||||||
return r;
|
|
||||||
if (r > 0) {
|
r = dns_cache_lookup(&t->scope->cache, t->question, &t->cached_rcode, &t->cached);
|
||||||
log_debug("Cache hit!");
|
if (r < 0)
|
||||||
if (t->cached_rcode == DNS_RCODE_SUCCESS)
|
return r;
|
||||||
dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS);
|
if (r > 0) {
|
||||||
else
|
log_debug("Cache hit!");
|
||||||
dns_transaction_complete(t, DNS_TRANSACTION_FAILURE);
|
if (t->cached_rcode == DNS_RCODE_SUCCESS)
|
||||||
return 0;
|
dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS);
|
||||||
|
else
|
||||||
|
dns_transaction_complete(t, DNS_TRANSACTION_FAILURE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("Cache miss!");
|
log_debug("Cache miss!");
|
||||||
|
Loading…
Reference in New Issue
Block a user