From 1292e1a557077b710c9daba33b79da66e4d89de6 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Fri, 25 Oct 2019 17:31:53 +0100 Subject: [PATCH] Don't waste time caching zero-TTL DNS records. --- src/cache.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cache.c b/src/cache.c index b3ed50b..733e053 100644 --- a/src/cache.c +++ b/src/cache.c @@ -499,6 +499,13 @@ static struct crec *really_insert(char *name, union all_addr *addr, unsigned sho /* if previous insertion failed give up now. */ if (insert_error) return NULL; + + /* we don't cache zero-TTL records. */ + if (ttl == 0) + { + insert_error = 1; + return NULL; + } /* First remove any expired entries and entries for the name/address we are currently inserting. */