ret={}
if qtype ~= pdns.A then return -1, ret end -- only A records
- if not string.find(domain, "^www.") then return -1, ret end -- only things that start with www.
+ if not string.find(domain, "^www%.") then return -1, ret end -- only things that start with www.
if not matchnetmask(ip, "10.0.0.0/8", "192.168.0.0/16") then return -1, ret end -- only interfere with local queries
ret[1]={qtype=pdns.A, content="127.1.2.3"} -- add IN A 127.1.2.3
ret[2]={qtype=pdns.A, content="127.3.2.1"} -- add IN A 127.3.2.1
</warning>
</para>
<para>
- Finally, the function <function>matchnetmask(ip, netmask1, netmask2..)</function> is available to match incoming queries against
+ Finally, the function <function>matchnetmask(ip, netmask1, netmask2..)</function> (or <function>matchnetmask(ip, {netmask1, netmask2})</function>) is available to match incoming queries against
a number of netmasks. If any of these matches, the function returns true.
</para>
</sect2>
function nxdomain ( ip, domain, qtype )
print ("nxhandler called for: ", ip, domain, qtype, pdns.AAAA)
if qtype ~= pdns.A then return -1, {} end -- only A records
- if not string.find(domain, "^www.") then return -1, {} end -- only things that start with www.
+ if not string.find(domain, "^www%.") then return -1, {} end -- only things that start with www.
- if matchnetmask(ip, {"127.0.0.1/32", "10.1.0.0/16"}) -- , "192.168.0.0/16", "172.16.0.0/12", "::/0")
+ if matchnetmask(ip, {"127.0.0.1/32", "10.1.0.0/16"})
then
print "dealing"
ret={}