resolved: flush keys when DNS_RESOURCE_KEY_CACHE_FLUSH is set

In mDNS, DNS_RESOURCE_KEY_CACHE_FLUSH denotes whether other records with the
same key should be flushed from the cache.
This commit is contained in:
Daniel Mack 2015-08-04 14:12:46 +02:00
parent 23502de3b0
commit 90325e8c2e
1 changed files with 6 additions and 1 deletions

View 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;
}