Skip to content

Commit

Permalink
Add Query Log filtering for new virtual other upstream
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jan 19, 2022
1 parent 03c2987 commit 69cdfe9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,12 @@ void getAllQueries(const char *client_message, const int *sock)
sscanf(client_message, ">getallqueries-forward %255s", forwarddest);
filterforwarddest = true;

if(strcmp(forwarddest, "cache") == 0)
forwarddestid = -1;
else if(strcmp(forwarddest, "blocklist") == 0)
if(strcmp(forwarddest, "blocklist") == 0)
forwarddestid = -3;
else if(strcmp(forwarddest, "cache") == 0)
forwarddestid = -2;
else if(strcmp(forwarddest, "other") == 0)
forwarddestid = -1;
else
{
// Extract address/name and port
Expand Down Expand Up @@ -773,6 +775,7 @@ void getAllQueries(const char *client_message, const int *sock)
return;
}
}
logg("Filtering: %d", forwarddestid);
}

// Domain filtering?
Expand Down Expand Up @@ -987,10 +990,13 @@ void getAllQueries(const char *client_message, const int *sock)
if(filterforwarddest)
{
// Skip if not from the virtual blocking "upstream" server
if(forwarddestid == -2 && !query->flags.blocked)
if(forwarddestid == -3 && !query->flags.blocked)
continue;
// Does the user want to see queries answered from local cache?
else if(forwarddestid == -1 && query->status != QUERY_CACHE)
else if(forwarddestid == -2 && query->status != QUERY_CACHE)
continue;
// Does the user want to see queries from the "other" category
else if(forwarddestid == -1 && query->status != QUERY_IN_PROGRESS)
continue;
// Does the user want to see queries answered by an upstream server?
else if(forwarddestid >= 0 && forwarddestid != query->upstreamID)
Expand Down

0 comments on commit 69cdfe9

Please sign in to comment.