mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Detect if we cached the <CNAME> but still need to ask the upstream servers for the actual IPs. In think case we have to decrease the "cached" counter
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -274,6 +274,13 @@ void process_pihole_log(int file)
|
||||
break;
|
||||
}
|
||||
|
||||
// Get timestamp
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Test if the read line is a query line
|
||||
if(strstr(readbuffer," query[A") != NULL)
|
||||
{
|
||||
@@ -286,10 +293,6 @@ void process_pihole_log(int file)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get timestamp
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
|
||||
// Get minimum time stamp to analyze
|
||||
int differencetofullhour = time(NULL) % GCinterval;
|
||||
int mintime = (time(NULL) - GCdelay - differencetofullhour) - MAXLOGAGE;
|
||||
@@ -459,11 +462,6 @@ void process_pihole_log(int file)
|
||||
if(!checkQuery(readbuffer, "gravity.list"))
|
||||
continue;
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Get dnsmasq's ID for this transaction
|
||||
int dnsmasqID = getdnsmasqID(readbuffer);
|
||||
// Skip invalid lines
|
||||
@@ -513,11 +511,6 @@ void process_pihole_log(int file)
|
||||
if(!checkQuery(readbuffer, "forwarded"))
|
||||
continue;
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Get dnsmasq's ID for this transaction
|
||||
int dnsmasqID = getdnsmasqID(readbuffer);
|
||||
// Skip invalid lines
|
||||
@@ -569,6 +562,15 @@ void process_pihole_log(int file)
|
||||
// Check both UUID and generation of this query
|
||||
if(queries[i].id == dnsmasqID && queries[i].generation == loggeneration)
|
||||
{
|
||||
// Detect if we cached the <CNAME> but need to ask the upstream
|
||||
// servers for the actual IPs now
|
||||
if(queries[i].status == 2)
|
||||
{
|
||||
// Fix counters
|
||||
counters.cached--;
|
||||
validate_access("overTime", queries[i].timeidx, true, __LINE__, __FUNCTION__, __FILE__);
|
||||
overTime[queries[i].timeidx].cached--;
|
||||
}
|
||||
queries[i].status = 2;
|
||||
queries[i].forwardID = forwardID;
|
||||
found = true;
|
||||
@@ -611,11 +613,6 @@ void process_pihole_log(int file)
|
||||
if(!checkQuery(readbuffer, "cached"))
|
||||
continue;
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Get dnsmasq's ID for this transaction
|
||||
int dnsmasqID = getdnsmasqID(readbuffer);
|
||||
// Skip invalid lines
|
||||
@@ -663,11 +660,6 @@ void process_pihole_log(int file)
|
||||
if(!checkQuery(readbuffer, "config"))
|
||||
continue;
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Get dnsmasq's ID for this transaction
|
||||
int dnsmasqID = getdnsmasqID(readbuffer);
|
||||
// Skip invalid lines
|
||||
@@ -733,11 +725,6 @@ void process_pihole_log(int file)
|
||||
if(!checkQuery(readbuffer, "black.list"))
|
||||
continue;
|
||||
|
||||
// Check if this query has already been imported from the database
|
||||
int querytimestamp, overTimetimestamp;
|
||||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp);
|
||||
if(querytimestamp < lastDBimportedtimestamp) continue;
|
||||
|
||||
// Get dnsmasq's ID for this transaction
|
||||
int dnsmasqID = getdnsmasqID(readbuffer);
|
||||
// Skip invalid lines
|
||||
|
||||
Reference in New Issue
Block a user