From 023461fc64e701e1101182f9d1f68dbec65f828a Mon Sep 17 00:00:00 2001 From: bert hubert Date: Mon, 5 Jan 2015 13:32:38 +0100 Subject: [PATCH] expand our example script to benefit from the iputils code in prequery --- pdns/powerdns-example-script.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pdns/powerdns-example-script.lua b/pdns/powerdns-example-script.lua index bf86cb815c..d168c5fdcd 100644 --- a/pdns/powerdns-example-script.lua +++ b/pdns/powerdns-example-script.lua @@ -168,3 +168,17 @@ function prequery(remoteip, domain, qtype) return -1,{} end end + + +nmg=iputils.newnmgroup() +nmg:add("192.121.121.0/24") + +function prequery(remoteip, domain, qtype) + print("pdns wants to ask "..remoteip:tostring().." about "..domain.." "..qtype) + if(nmg:match(remoteip)) + then + print("We matched the group ", nmg,"!", "killing query dead") + return -3,{} + end + return -1,{} +end -- 2.47.2