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
dnsdist: Change dnsdist stats functions to always return lowercase names #5383
Conversation
@@ -158,7 +158,7 @@ std::unordered_map<int, vector<boost::variant<string,double>>> getGenResponses(u | |||
vector<pair<int, DNSName>> rcounts; | |||
rcounts.reserve(counts.size()); | |||
for(const auto& c : counts) | |||
rcounts.push_back(make_pair(c.second, c.first)); | |||
rcounts.push_back(make_pair(c.second, c.first.makeLowerCase())); |
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 you need to lowercase earlier otherwise the counts are going to be off.
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.
Nope since it uses maps, which uses the default compare and less operators, which in turn lowercase everything themselves.
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.
Oh, you are right, my bad!
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 wonder if it wouldn't be better to lowercase a bit later then, replacing rc.second.toString()
by something like rc.second.makeLowerCase().toString()
, so we only do the lowercasing for the names we are going to print, not all of them.
@@ -1351,7 +1351,7 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi | |||
vector<pair<int, DNSName>> rcounts; | |||
rcounts.reserve(counts.size()); | |||
for(const auto& c : counts) | |||
rcounts.push_back(make_pair(c.second, c.first)); | |||
rcounts.push_back(make_pair(c.second, c.first.makeLowerCase())); |
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.
Same thing here.
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.
As above.
Short description
Changes getTopQueries and getGenResponses to return lowercase versions for all names. Closes #5287
Checklist
I have: