]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/ta_signal_query: optimize
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 14 Aug 2019 15:16:58 +0000 (17:16 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Mon, 2 Dec 2019 12:34:52 +0000 (13:34 +0100)
Basically the same as the parent commit (just much simpler).

modules/ta_signal_query/ta_signal_query.lua

index d1945c7e7e403efe7cd3d27957320b1b6d728d49..081d7982de1e558ca7d994ec53af691f30cd348f 100644 (file)
@@ -50,10 +50,13 @@ local function send_ta_query(domain)
 end
 
 -- act on DNSKEY queries which were not answered from cache
-function M.layer.consume(state, req, _)
-       local qry = req:current()
-       if qry.stype == kres.type.DNSKEY and not qry.flags.CACHED then
-               send_ta_query(qry:name())
+function M.layer.consume(state, req, pkt)
+       -- First check for standard "cached packets": PKT_SIZE_NOWIRE, for efficiency.
+       if pkt.size ~= -1 and pkt:qtype() == kres.type.DNSKEY then
+               local qry = req:current()
+               if not qry.flags.CACHED then
+                       send_ta_query(qry:name())
+               end
        end
        return state  -- do not interfere with normal query processing
 end