]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: flush keys when DNS_RESOURCE_KEY_CACHE_FLUSH is set
authorDaniel Mack <daniel@zonque.org>
Tue, 4 Aug 2015 12:12:46 +0000 (14:12 +0200)
committerDaniel Mack <daniel@zonque.org>
Tue, 8 Dec 2015 15:51:39 +0000 (16:51 +0100)
In mDNS, DNS_RESOURCE_KEY_CACHE_FLUSH denotes whether other records with the
same key should be flushed from the cache.

src/resolve/resolved-dns-cache.c

index bcb9994a8c567f842e6cd99a1f5da97c81606e7e..2179a61890683eb0b9aa2469711a45194b414f99 100644 (file)
@@ -459,7 +459,12 @@ int dns_cache_put(
 
         /* Second, add in positive entries for all contained RRs */
         for (i = 0; i < MIN(max_rrs, answer->n_rrs); i++) {
-                r = dns_cache_put_positive(c, answer->items[i].rr, authenticated, timestamp, owner_family, owner_address);
+                DnsResourceRecord *rr = answer->items[i].rr;
+
+                if (rr->key->cache_flush)
+                        dns_cache_remove(c, rr->key);
+
+                r = dns_cache_put_positive(c, rr, authenticated, timestamp, owner_family, owner_address);
                 if (r < 0)
                         goto fail;
         }