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:
DL6ER
2018-03-04 23:26:07 +01:00
parent b5efce7671
commit e3f9685a8f
2 changed files with 9 additions and 7 deletions
+1
View File
@@ -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
View File
@@ -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)