diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-05 01:42:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-05 01:52:24 +0200 |
commit | 4d926a69bc27b8fbd4891bb10c03336bd8d93b7a (patch) | |
tree | 86c1a499bc6f48d1cc3a4c3ea9aa01467802411c /src/resolve | |
parent | resolved: if there's already an RR established that has the same name of an R... (diff) | |
download | systemd-4d926a69bc27b8fbd4891bb10c03336bd8d93b7a.tar.xz systemd-4d926a69bc27b8fbd4891bb10c03336bd8d93b7a.zip |
resolved: bypass local cache when we issue a transaction for verification purposes
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-dns-transaction.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 48da432a12..83933c6502 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -465,24 +465,29 @@ int dns_transaction_go(DnsTransaction *t) { t->cached = dns_answer_unref(t->cached); t->cached_rcode = 0; - /* Before trying the cache, let's make sure we figured out a - * server to use. Should this cause a change of server this - * might flush the cache. */ - dns_scope_get_dns_server(t->scope); + /* Check the cache, but only if this transaction is not used + * for probing or verifying a zone item. */ + if (set_isempty(t->zone_items)) { - /* Let's then prune all outdated entries */ - dns_cache_prune(&t->scope->cache); + /* Before trying the cache, let's make sure we figured out a + * 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); - if (r < 0) - return r; - if (r > 0) { - log_debug("Cache hit!"); - if (t->cached_rcode == DNS_RCODE_SUCCESS) - dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS); - else - dns_transaction_complete(t, DNS_TRANSACTION_FAILURE); - return 0; + /* Let's then prune all outdated entries */ + dns_cache_prune(&t->scope->cache); + + r = dns_cache_lookup(&t->scope->cache, t->question, &t->cached_rcode, &t->cached); + if (r < 0) + return r; + if (r > 0) { + log_debug("Cache hit!"); + if (t->cached_rcode == DNS_RCODE_SUCCESS) + dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS); + else + dns_transaction_complete(t, DNS_TRANSACTION_FAILURE); + return 0; + } } log_debug("Cache miss!"); |