From: Otto Moerbeek Date: Fri, 4 Feb 2022 08:10:35 +0000 (+0100) Subject: Fix most runtime issues, the script suffered bit-rot X-Git-Tag: auth-4.7.0-alpha1~20^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00198a5aaa0fdc47fc3ae8fdba729df7b3216061;p=thirdparty%2Fpdns.git Fix most runtime issues, the script suffered bit-rot --- diff --git a/pdns/recursordist/contrib/powerdns-example-script.lua b/pdns/recursordist/contrib/powerdns-example-script.lua index 232db439c6..6a83d23d13 100644 --- a/pdns/recursordist/contrib/powerdns-example-script.lua +++ b/pdns/recursordist/contrib/powerdns-example-script.lua @@ -18,9 +18,9 @@ badips:addMask("127.1.0.0/16") -- this check is applied before any packet parsing is done function ipfilter(rem, loc, dh) - pdnslog("ipfilter called, rem: "..rem:toStringWithPort().."loc: "..loc:toStringWithPort().."match:"..badips:match(rem)) - pdnslog("id: "..dh:getID().."aa: "..dh:getAA().."ad: "..dh:getAD().."arcount: "..dh:getARCOUNT()) - pdnslog("ports: "..rem:getPort()..loc:getPort()) + pdnslog("ipfilter called, rem: "..rem:toStringWithPort().."loc: "..loc:toStringWithPort().." match:"..tostring(badips:match(rem))) + pdnslog("id: "..dh:getID().."aa: "..tostring(dh:getAA()).."ad: "..tostring(dh:getAD()).." arcount: "..dh:getARCOUNT()) + pdnslog("ports: "..rem:getPort().." "..loc:getPort()) return badips:match(rem) end @@ -36,7 +36,6 @@ function preresolve(dq) pdnslog("Packet EDNS subnet source: "..ednssubnet:toString()..", "..ednssubnet:getNetwork():toString()) end - local a = dq:getEDNSOption(3) if a then @@ -57,10 +56,10 @@ function preresolve(dq) pdnslog("not magic..") end - if dq.qname:__eq(magic2) -- we hope to improve this syntax + if dq.qname == magic2 then pdnslog("Faster magic") -- compares against existing DNSName - end -- sadly, dq.qname == magic2 won't work yet + end if blockset:check(dq.qname) then @@ -85,11 +84,10 @@ function preresolve(dq) dq.followupFunction = "followCNAMERecords" -- this makes PowerDNS lookup your CNAME return true; end - + return false; end - -- this implements DNS64 function nodata(dq) @@ -117,7 +115,7 @@ function postresolve(dq) pdnslog("postresolve called for "..dq.qname:toString()) local records = dq:getRecords() for k,v in pairs(records) do - pdnslog(k, v.name:toString()..v:getContent()) + pdnslog(k.." "..v.name:toString().." "..v:getContent()) if v.type == pdns.A and v:getContent() == "185.31.17.73" then pdnslog("Changing content!")