-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle dnsmasq "extra" logging #174
Conversation
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…etection into its own subroutine to avoid large repitions of code. Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…ave a path + removed some debugging output Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…ries) Signed-off-by: DL6ER <dl6er@dl6er.de>
…IGHUP) Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…very unique Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Still working fine for me with no queries that cannot be determined (see
100% accuracy is verified via visual inspection in a few very busy regions. This PR can be merged at any point to |
…rong but nobody noticed it) Signed-off-by: DL6ER <dl6er@dl6er.de>
database.c
Outdated
// Already in database | ||
// logg("Skipping %i",i); | ||
if(queries[i].timestamp <= lasttimestamp || queries[i].db || !queries[i].complete) | ||
// Already in database or not yet complete | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we skip a query while it's still not yet complete and the one after is complete, we would lose the first query. Perhaps change this to a break
so that we never add any queries after one which is not complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure if that is a good solution - although it never happend to me so far, this could be a potential dead-lock assuming that dnsmasq
didn't write out the result for one query so it would never be completed. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe bring back the 200 line check or convert it to a timestamp check. If the query hasn't completed after 2 seconds, assume it's a goner and continue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will in addition compare the time stamp of the query with the current time and break
if the query was from within the most recent two seconds. It will have a chance to get saved (or eventually ignored) on the next DB dumping time.
request.c
Outdated
|
||
if(!debug) | ||
{ | ||
sprintf(server_message,"For safety reasons, the command is only available in debugging mode!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially this command was supposed to do something different, I will remove this statement here.
parser.c
Outdated
if(dnsmasqID < 0) | ||
continue; | ||
|
||
// Save forwardID in corresponding query indentified by dnsmasq's ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment supposed to reference forwardID
or status
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, will fix this
parser.c
Outdated
int querytimestamp, overTimetimestamp, timeidx = -1, i; | ||
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp); | ||
|
||
// Save forwardID in corresponding query indentified by dnsmasq's ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is where that comment came from (see above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree :-)
parser.c
Outdated
else if(strstr(readbuffer," config ") != NULL && strstr(readbuffer," is ") != NULL) | ||
{ | ||
// Check query for invalid characters | ||
if(!checkQuery(readbuffer, "gravity.list")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct type for wildcards?
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
… a query more time to get completed Signed-off-by: DL6ER <dl6er@dl6er.de>
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/cache-server-statistics/6092/1 |
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/tracking-request-status-unambiguously/6091/1 |
By submitting this pull request, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your PR:
Please submit all pull requests against the
development
branch. Failure to do so will delay or deny your requestHow familiar are you with the codebase?:
10
Complete re-write of
FTL
log file parser to usednsmasq
's UUIDs present in the log if optionlog-queries=extra
is set. This will ensure 100% correctness of the interpreted log files.One particular difficulty with
dnsmasq
'sextra
logging is that it resets the UUID counter to 0 when being restarted. This poisons the whole idea of having UUIDs. A proper failsafe condition (using the idea of UUID generations) has been implemented in the new parser.Note that this is a breaking change as the "old" log format cannot be read anymore and as such will bump
FTL
's version tov3.0
.This template was created based on the work of
udemy-dl
.