mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Handle correctly that config is only read at initialization, whereas hosts files are read also on reload (SIGHUP)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -109,6 +109,7 @@ typedef struct {
|
||||
int overTime_MAX;
|
||||
int wildcarddomains_MAX;
|
||||
int gravity;
|
||||
int gravity_conf;
|
||||
int overTime;
|
||||
int querytype[7];
|
||||
int wildcarddomains;
|
||||
|
||||
+8
-7
@@ -250,24 +250,25 @@ void FTL_read_hosts(char * filename, int addr_count)
|
||||
{
|
||||
// Interpret hosts files that have been read by dnsmasq
|
||||
// We ignore other read lists like /etc/hosts
|
||||
enable_thread_lock();
|
||||
if(counters.gravity == 0 && counters.gravity_conf > 0)
|
||||
counters.gravity += counters.gravity_conf;
|
||||
|
||||
if(filename != NULL && (strstr(filename, "/gravity.list") != NULL ||
|
||||
strstr(filename, "/black.list") != NULL))
|
||||
{
|
||||
counters.gravity += addr_count;
|
||||
}
|
||||
disable_thread_lock();
|
||||
}
|
||||
|
||||
void FTL_read_config(int flags)
|
||||
{
|
||||
// Interpret blocking configuration that have been read by dnsmasq
|
||||
enable_thread_lock();
|
||||
// No need for thread locks here as this happens while the resolver
|
||||
// is not yet ready
|
||||
if((flags & SERV_HAS_DOMAIN) && (flags & SERV_NO_ADDR))
|
||||
counters.gravity++; // Blacklist
|
||||
else if((flags & SERV_USE_RESOLV) && counters.gravity > 0)
|
||||
counters.gravity--; // Whitelist
|
||||
disable_thread_lock();
|
||||
counters.gravity_conf++; // Blacklist
|
||||
else if((flags & SERV_USE_RESOLV) && counters.gravity_conf > 0)
|
||||
counters.gravity_conf--; // Whitelist
|
||||
}
|
||||
|
||||
void FTL_reply(unsigned short flags, char *name, struct all_addr *addr, unsigned long ttl, int id)
|
||||
|
||||
Reference in New Issue
Block a user