return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn, quiet ? *quiet : false));
});
- g_lua.writeFunction("NetmaskGroupRule", [](const NetmaskGroup& nmg, boost::optional<bool> src) {
- return std::shared_ptr<DNSRule>(new NetmaskGroupRule(nmg, src ? *src : true));
+ g_lua.writeFunction("NetmaskGroupRule", [](const NetmaskGroup& nmg, boost::optional<bool> src, boost::optional<bool> quiet) {
+ return std::shared_ptr<DNSRule>(new NetmaskGroupRule(nmg, src ? *src : true, quiet ? *quiet : false));
});
g_lua.writeFunction("benchRule", [](std::shared_ptr<DNSRule> rule, boost::optional<int> times_, boost::optional<string> suffix_) {
class NetmaskGroupRule : public NMGRule
{
public:
- NetmaskGroupRule(const NetmaskGroup& nmg, bool src) : NMGRule(nmg)
+ NetmaskGroupRule(const NetmaskGroup& nmg, bool src, bool quiet = false) : NMGRule(nmg)
{
d_src = src;
+ d_quiet = quiet;
}
bool matches(const DNSQuestion* dq) const override
{
string toString() const override
{
+ string ret = "Src: ";
if(!d_src) {
- return "Dst: "+d_nmg.toString();
+ ret = "Dst: ";
}
- return "Src: "+d_nmg.toString();
+ if (d_quiet) {
+ return ret + "in-group";
+ }
+ return ret + d_nmg.toString();
}
private:
bool d_src;
+ bool d_quiet;
};
class TimedIPSetRule : public DNSRule, boost::noncopyable
:param int qps: The number of queries per second allowed, above this number the traffic is **not** matched anymore
-.. function:: NetmaskGroupRule(nmg[, src])
+.. function:: NetmaskGroupRule(nmg[, src[, quiet]])
+
+ .. versionchanged:: 1.4.0
+ ``quiet`` parameter added
Matches traffic from/to the network range specified in ``nmg``.
:param NetMaskGroup nmg: The NetMaskGroup to match on
:param bool src: Whether to match source or destination address of the packet. Defaults to true (matches source)
+ :param bool quiet: Do not return the list of matched netmasks. Default is false.
.. function:: OpcodeRule(code)