summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-cache.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-30 01:46:27 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-30 01:47:10 +0200
commitd2f47562d5d834339ef3030e345a76a8c6f09c74 (patch)
treee2a8360cf8ad355cabd63a782f6d1de146f74d0a /src/resolve/resolved-dns-cache.c
parent0f05c387597a93fa74cdf7d351fd255aca56026d (diff)
resolved: only cache answer RRs, never additional or authoritative RRs of responses
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r--src/resolve/resolved-dns-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 8c859d19b5..c971167452 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -337,7 +337,7 @@ static int dns_cache_put_negative(DnsCache *c, DnsResourceKey *key, int rcode, u
return 0;
}
-int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, usec_t timestamp) {
+int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, unsigned max_rrs, usec_t timestamp) {
unsigned i;
int r;
@@ -365,7 +365,7 @@ int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, use
timestamp = now(CLOCK_MONOTONIC);
/* Second, add in positive entries for all contained RRs */
- for (i = 0; i < answer->n_rrs; i++) {
+ for (i = 0; i < MIN(max_rrs, answer->n_rrs); i++) {
r = dns_cache_put_positive(c, answer->rrs[i], timestamp);
if (r < 0)
goto fail;