]> granicus.if.org Git - pdns/commitdiff
expand our example script to benefit from the iputils code in prequery
authorbert hubert <bert.hubert@netherlabs.nl>
Mon, 5 Jan 2015 12:32:38 +0000 (13:32 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Mon, 5 Jan 2015 12:32:38 +0000 (13:32 +0100)
pdns/powerdns-example-script.lua

index bf86cb815c30e68e19c2b058e759c9602fd4b199..d168c5fdcd022946c6e9032915f3d076e12cbf91 100644 (file)
@@ -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