Reset per-client domain blocking cache at receipt of SIGUSR2. This is a convenient alternative to sending SIGHUP (which also clears the entire DNS cache).

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-11-23 22:55:57 +01:00
parent 4269897b58
commit f9be16e61b
3 changed files with 24 additions and 0 deletions
+2
View File
@@ -1412,6 +1412,8 @@ static void async_event(int pipe, time_t now)
we leave them logging to the old file. */
if (daemon->log_file != NULL)
log_reopen(daemon->log_file);
FTL_reset_per_client_domain_data();
break;
case EVENT_NEWADDR:
+20
View File
@@ -1556,3 +1556,23 @@ static void prepare_blocking_metadata(void)
// Free IPv6addr
clearSetupVarsArray();
}
void FTL_reset_per_client_domain_data(void)
{
logg("Received SIGUSR2, resetting domain blocking data");
for(int domainID = 0; domainID < counters->domains; domainID++)
{
domainsData *domain = getDomain(domainID, true);
if(domain == NULL)
continue;
for(int clientID = 0; clientID < counters->clients; clientID++)
{
// Reset all blocking yes/no fields for all domains and clients
// This forces a reprocessing of all available filters for any
// given domain and client the next time they are seen
domain->clientstatus->set(domain->clientstatus, clientID, UNKNOWN_BLOCKED);
}
}
}
+2
View File
@@ -49,4 +49,6 @@ void _FTL_get_blocking_metadata(struct all_addr **addrp, unsigned int *flags, co
void FTL_dnsmasq_reload(void);
void FTL_fork_and_bind_sockets(struct passwd *ent_pw);
void FTL_reset_per_client_domain_data(void);
#endif // DNSMASQ_INTERFACE_H