diff --git a/dnsmasq/cache.c b/dnsmasq/cache.c index f43cfb48..9b0f9772 100644 --- a/dnsmasq/cache.c +++ b/dnsmasq/cache.c @@ -1689,11 +1689,11 @@ char *record_source(unsigned int index) return HOSTSFILE; /*----- Pi-hole modification -----*/ else if (index == SRC_REGEX) - return "regex"; + return SRC_REGEX_NAME; else if (index == SRC_GRAVITY) - return "gravity"; + return SRC_GRAVITY_NAME; else if (index == SRC_BLACK) - return "blacklist"; + return SRC_BLACK_NAME; /*--------------------------------*/ for (ah = daemon->addn_hosts; ah; ah = ah->next) diff --git a/dnsmasq/dnsmasq.h b/dnsmasq/dnsmasq.h index 94534afe..e096dfcf 100644 --- a/dnsmasq/dnsmasq.h +++ b/dnsmasq/dnsmasq.h @@ -496,8 +496,11 @@ struct crec { // ID 5 will be used for the blacklist table // ID 6 will be used as starting index for any Additional Hosts (AH) files #define SRC_REGEX 3 +#define SRC_REGEX_NAME "regex" #define SRC_GRAVITY 4 +#define SRC_GRAVITY_NAME "gravity" #define SRC_BLACK 5 +#define SRC_BLACK_NAME "blacklist" #define SRC_AH 6 /*------------------------------------------------------------------------*/ diff --git a/dnsmasq_interface.c b/dnsmasq_interface.c index 327c7c5e..4e300d0a 100644 --- a/dnsmasq_interface.c +++ b/dnsmasq_interface.c @@ -734,7 +734,9 @@ void _FTL_cache(const unsigned int flags, const char *name, const struct all_add (flags & F_REVERSE) || (flags & F_RRNAME)) { - // List data: /etc/pihole/gravity.list, /etc/pihole/black.list, /etc/pihole/local.list, etc. + // Local list: /etc/hosts, /etc/pihole/local.list, etc. + // or + // blocked domain from gravity database // or // DHCP server reply // or @@ -746,9 +748,9 @@ void _FTL_cache(const unsigned int flags, const char *name, const struct all_add unsigned char requesttype = 0; if(flags & F_HOSTS) { - if(arg != NULL && strstr(arg, "gravity") != NULL) + if(arg != NULL && strcmp(arg, "gravity") == 0) requesttype = QUERY_GRAVITY; - else if(arg != NULL && strstr(arg, "blacklist") != NULL) + else if(arg != NULL && strcmp(arg, "blacklist") == 0) requesttype = QUERY_BLACKLIST; else // local.list, hostname.list, /etc/hosts and others requesttype = QUERY_CACHE;