From: bert hubert Date: Tue, 15 Dec 2015 08:45:10 +0000 (+0100) Subject: allRule() for dnsdist X-Git-Tag: dnsdist-1.0.0-alpha1~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89cb6f9a89264ef0d418272782f292a4700e8d24;p=thirdparty%2Fpdns.git allRule() for dnsdist --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 0c54b975dd..c20cf6bbd4 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -533,6 +533,11 @@ vector> setupLua(bool client, const std::string& confi g_outputBuffer=(boost::format("Had %d matches out of %d, %.1f qps, in %.1f usec\n") % matches % times % (1000000*(1.0*times/udiff)) % udiff).str(); }); + + g_lua.writeFunction("AllRule", []() { + return std::shared_ptr(new AllRule()); + }); + g_lua.writeFunction("QTypeRule", [](boost::variant str) { uint16_t qtype; if(auto dir = boost::get(&str)) { diff --git a/pdns/dnsrulactions.hh b/pdns/dnsrulactions.hh index 451a313f25..d0e3621701 100644 --- a/pdns/dnsrulactions.hh +++ b/pdns/dnsrulactions.hh @@ -81,6 +81,23 @@ private: NetmaskGroup d_nmg; }; +class AllRule : public DNSRule +{ +public: + AllRule() {} + bool matches(const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh, int len) const override + { + return true; + } + + string toString() const override + { + return "All"; + } + +}; + + class DNSSECRule : public DNSRule { public: