[systemd-commits] 2 commits - TODO src/resolve

Lennart Poettering lennart at kemper.freedesktop.org
Wed Jul 30 05:14:27 PDT 2014


 TODO                             |    1 -
 src/resolve/resolved-dns-cache.c |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 6bf02ccb14a8f9791b0896f1e95d6e0522dd59ed
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 30 11:27:05 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index 158236b..aabdd16 100644
--- a/TODO
+++ b/TODO
@@ -38,7 +38,6 @@ Features:
         - send notifications of conflict
         - verify new RR uniqueness
         - detect conflicts
-        - cache lookups with ANY types or classes
         - collect multiple responses
         - jitter interval support
         - add SOA record to empty responses

commit ddf163393bd93baf39fa7a2c567f6758570cc209
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 30 11:26:49 2014 +0200

    resolved: never cache ANY lookups

diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index c971167..28a375b 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -270,6 +270,11 @@ static int dns_cache_put_positive(DnsCache *c, DnsResourceRecord *rr, usec_t tim
                 return 0;
         }
 
+        if (rr->key->class == DNS_CLASS_ANY)
+                return 0;
+        if (rr->key->type == DNS_TYPE_ANY)
+                return 0;
+
         /* Entry exists already? Update TTL and timestamp */
         existing = dns_cache_get(c, rr);
         if (existing) {
@@ -311,6 +316,11 @@ static int dns_cache_put_negative(DnsCache *c, DnsResourceKey *key, int rcode, u
 
         dns_cache_remove(c, key);
 
+        if (key->class == DNS_CLASS_ANY)
+                return 0;
+        if (key->type == DNS_TYPE_ANY)
+                return 0;
+
         if (!IN_SET(rcode, DNS_RCODE_SUCCESS, DNS_RCODE_NXDOMAIN))
                 return 0;
 
@@ -426,6 +436,14 @@ int dns_cache_lookup(DnsCache *c, DnsQuestion *q, int *rcode, DnsAnswer **ret) {
         for (i = 0; i < q->n_keys; i++) {
                 DnsCacheItem *j;
 
+                if (q->keys[i]->type == DNS_TYPE_ANY ||
+                    q->keys[i]->class == DNS_CLASS_ANY) {
+                        /* If we have ANY lookups we simply refresh */
+                        *ret = NULL;
+                        *rcode = 0;
+                        return 0;
+                }
+
                 j = hashmap_get(c->by_key, q->keys[i]);
                 if (!j) {
                         /* If one question cannot be answered we need to refresh */



More information about the systemd-commits mailing list