[Dnsmasq-discuss] [PATCH] Fix bug where cached NXDOMAIN CNAMEs return NODATA

Geert Stappers stappers at stappers.nl
Thu Sep 17 20:55:52 BST 2020


From: "Dominick C. Pastore" <dominickpastore at dcpx.org>

Non-terminal code from 2.80 was overzealously converting NXDOMAIN AAAA
replies from upstream to NODATA when an NXDOMAIN A response was cached
(and vice-versa). Commit 162e5e0 fixed this for most cases, but not when
the NXDOMAIN response contained a CNAME. This fixes that case.

Tested-By: James Brown <jbrown at easypost.com>
---
 src/cache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cache.c b/src/cache.c
index 2f2c519..1102609 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -812,6 +812,7 @@ int cache_find_non_terminal(char *name, time_t now)
     if (!is_outdated_cname_pointer(crecp) &&
 	!is_expired(now, crecp) &&
 	(crecp->flags & F_FORWARD) &&
+	(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) &&
 	!(crecp->flags & F_NXDOMAIN) && 
 	hostname_isequal(name, cache_get_name(crecp)))
       return 1;
-- 
2.1.4




More information about the Dnsmasq-discuss mailing list