From: bert hubert Date: Mon, 5 Jan 2015 12:32:38 +0000 (+0100) Subject: expand our example script to benefit from the iputils code in prequery X-Git-Tag: rec-3.7.0-rc1~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=023461fc64e701e1101182f9d1f68dbec65f828a;p=pdns expand our example script to benefit from the iputils code in prequery --- diff --git a/pdns/powerdns-example-script.lua b/pdns/powerdns-example-script.lua index bf86cb815..d168c5fdc 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