mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
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:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user