Skip to content

Commit

Permalink
Ensure we subtract from the old reply counter when reply type changes
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Mar 26, 2022
1 parent a24e187 commit 8734b60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/database/query-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,14 @@ void DB_read_queries(void)
if(type < 100)
{
// Mapped query type
query->type = type;
if(type >= TYPE_A && type < TYPE_MAX)
query->type = type;
else
{
// Invalid query type
logg("DB warn: Query type %d is invalid.", type);
continue;
}
}
else
{
Expand Down Expand Up @@ -900,8 +907,7 @@ void DB_read_queries(void)
client->lastQuery = queryTimeStamp;

// Handle type counters
if(type >= TYPE_A && type < TYPE_MAX)
counters->querytype[type-1]++;
counters->querytype[query->type-1]++;

// Update overTime data
overTime[timeidx].total++;
Expand Down
6 changes: 3 additions & 3 deletions src/dnsmasq_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,6 @@ bool _FTL_new_query(const unsigned int flags, const char *name,
id, queryID, short_path(file), line);
}

// Update counters
counters->querytype[querytype-1]++;

// Update overTime
const unsigned int timeidx = getOverTimeID(querytimestamp);

Expand Down Expand Up @@ -755,6 +752,9 @@ bool _FTL_new_query(const unsigned int flags, const char *name,
client->lastQuery = querytimestamp;
client->numQueriesARP++;

// Update counters
counters->querytype[querytype-1]++;

// Process interface information of client (if available)
// Skip interface name length 1 to skip "-". No real interface should
// have a name with a length of 1...
Expand Down

0 comments on commit 8734b60

Please sign in to comment.