diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-12-18 19:06:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-12-18 19:06:23 +0100 |
commit | 222148b66d1abf5b05c9d803472a9368331dae53 (patch) | |
tree | 2b149f95d2ebb327191e5c8da9a96b134276133a /src/resolve/resolved-dns-cache.c | |
parent | ff7febd50a69c464eb2373706059194b60056883 (diff) |
resolved: make use of dns_{class|type}_is_{pseudo|valid_rr}() everywhere
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r-- | src/resolve/resolved-dns-cache.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c index a8d612794c..9ad3c0e82b 100644 --- a/src/resolve/resolved-dns-cache.c +++ b/src/resolve/resolved-dns-cache.c @@ -282,6 +282,12 @@ static int dns_cache_put_positive( assert(rr); assert(owner_address); + /* Never cache pseudo RRs */ + if (dns_class_is_pseudo(rr->key->class)) + return 0; + if (dns_type_is_pseudo(rr->key->type)) + return 0; + /* New TTL is 0? Delete the entry... */ if (rr->ttl <= 0) { k = dns_cache_remove(c, rr->key); @@ -300,11 +306,6 @@ static int dns_cache_put_positive( return 0; } - if (rr->key->class == DNS_CLASS_ANY) - return 0; - if (dns_type_is_pseudo(rr->key->type)) - return 0; - /* Entry exists already? Update TTL and timestamp */ existing = dns_cache_get(c, rr); if (existing) { @@ -368,12 +369,15 @@ static int dns_cache_put_negative( dns_cache_remove(c, key); - if (key->class == DNS_CLASS_ANY) + /* Never cache pseudo RR keys */ + if (dns_class_is_pseudo(key->class)) return 0; if (dns_type_is_pseudo(key->type)) - /* ANY is particularly important to filter out as we - * use this as a pseudo-type for NXDOMAIN entries */ + /* DNS_TYPE_ANY is particularly important to filter + * out as we use this as a pseudo-type for NXDOMAIN + * entries */ return 0; + if (soa_ttl <= 0) { if (log_get_max_level() >= LOG_DEBUG) { r = dns_resource_key_to_string(key, &key_str); |