Skip to content
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

implement a 'quiet' mode for SuffixMatchNodeRule() which prevents Sho… #3826

Merged
merged 1 commit into from
May 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pdns/README-dnsdist.md
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ instantiate a server with additional parameters
* `QClassRule(qclass)`: matches queries with the specified qclass (numeric)
* `QTypeRule(qtype)`: matches queries with the specified qtype
* `RegexRule(regex)`: matches the query name against the supplied regex
* `SuffixMatchNodeRule()`: matches based on a group of domain suffixes for rapid testing of membership
* `SuffixMatchNodeRule(smn, [quiet-bool])`: matches based on a group of domain suffixes for rapid testing of membership. Pass `true` as second parameter to prevent listing of all domains matched.
* `TCPRule(tcp)`: matches question received over TCP if `tcp` is true, over UDP otherwise
* Rule management related:
* `getAction(num)`: returns the Action associate with rule 'num'.
Expand Down
4 changes: 2 additions & 2 deletions pdns/dnsdist-lua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
});
#endif

g_lua.writeFunction("SuffixMatchNodeRule", [](const SuffixMatchNode& smn) {
return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn));
g_lua.writeFunction("SuffixMatchNodeRule", [](const SuffixMatchNode& smn, boost::optional<bool> quiet) {
return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn, quiet ? *quiet : false));
});

g_lua.writeFunction("NetmaskGroupRule", [](const NetmaskGroup& nmg) {
Expand Down
8 changes: 6 additions & 2 deletions pdns/dnsrulactions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private:
class SuffixMatchNodeRule : public DNSRule
{
public:
SuffixMatchNodeRule(const SuffixMatchNode& smn) : d_smn(smn)
SuffixMatchNodeRule(const SuffixMatchNode& smn, bool quiet=false) : d_smn(smn), d_quiet(quiet)
{
}
bool matches(const DNSQuestion* dq) const override
Expand All @@ -263,10 +263,14 @@ public:
}
string toString() const override
{
return "qname=="+d_smn.toString();
if(d_quiet)
return "qname==in-set";
else
return "qname=="+d_smn.toString();
}
private:
SuffixMatchNode d_smn;
bool d_quiet;
};

class QTypeRule : public DNSRule
Expand Down