From 02c2857b8d9bb61305c9857161c85ada801b8cb8 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Thu, 10 Dec 2015 19:57:41 +0100 Subject: resolved: cache - don't flush the cache of mDNS records unneccesarily When the DNS_RESOURCE_KEY_CACHE_FLUSH flag is not set for an mDNS packet, we should not flush the cache for RRs with matching keys. However, we were unconditionally flushing the cache also for these packets. Now mark all packets as cache_flush by default, except for these mDNS packets, and respect that flag in the cache handling. This fixes 90325e8c2e559a21ef0bc2f26b844c140faf8020. --- src/resolve/resolved-dns-packet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/resolve/resolved-dns-packet.c') diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c index 399ba59749..e90500ce70 100644 --- a/src/resolve/resolved-dns-packet.c +++ b/src/resolve/resolved-dns-packet.c @@ -1451,7 +1451,7 @@ fail: int dns_packet_read_key(DnsPacket *p, DnsResourceKey **ret, size_t *start) { _cleanup_free_ char *name = NULL; - bool cache_flush = false; + bool cache_flush = true; uint16_t class, type; DnsResourceKey *key; size_t saved_rindex; @@ -1477,10 +1477,10 @@ int dns_packet_read_key(DnsPacket *p, DnsResourceKey **ret, size_t *start) { if (p->protocol == DNS_PROTOCOL_MDNS) { /* See RFC6762, Section 10.2 */ - if (class & MDNS_RR_CACHE_FLUSH) { + if (class & MDNS_RR_CACHE_FLUSH) class &= ~MDNS_RR_CACHE_FLUSH; - cache_flush = true; - } + else + cache_flush = false; } key = dns_resource_key_new_consume(class, type, name); -- cgit v1.2.3-54-g00ecf