From c6b99fc11e6f1a67105fdcb90fa437e025bae5ab Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 8 Aug 2016 21:11:06 +0200 Subject: [PATCH] expose SMN toString to lua --- docs/markdown/recursor/scripting.md | 2 ++ pdns/lua-recursor4.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/markdown/recursor/scripting.md b/docs/markdown/recursor/scripting.md index ac3291ad8..b551c8f93 100644 --- a/docs/markdown/recursor/scripting.md +++ b/docs/markdown/recursor/scripting.md @@ -264,6 +264,8 @@ be `true` if dq.qname is part of any of the Suffix Match group domains. This could e.g. be used to answer questions for known malware domains. +To see the set of suffixes matched by a Suffix Match Group, use `:toString()`. + ### Metrics You can custom metrics which will be shown in the output of 'rec_control get-all' and sent to the metrics server over the Carbon protocol, and also appear in the diff --git a/pdns/lua-recursor4.cc b/pdns/lua-recursor4.cc index 0db7ef432..10aad19a3 100644 --- a/pdns/lua-recursor4.cc +++ b/pdns/lua-recursor4.cc @@ -387,6 +387,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) catch(std::exception& e) { theL() <registerFunction("check",(bool (SuffixMatchNode::*)(const DNSName&) const) &SuffixMatchNode::check); + d_lw->registerFunction("toString",(string (SuffixMatchNode::*)() const) &SuffixMatchNode::toString); d_lw->writeFunction("pdnslog", [](const std::string& msg, boost::optional loglevel) { -- 2.40.0