]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
trust anchors: nitpicks
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 6 Feb 2017 13:10:11 +0000 (14:10 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 9 Feb 2017 16:42:32 +0000 (17:42 +0100)
- printing refresh time in milliseconds could've been confusing;
- move syntactic sugar definitions close to the rest of the table;

daemon/lua/sandbox.lua
daemon/lua/trust_anchors.lua.in

index 4a5b3cb6d8a6b06143e28655d1d2b7b1003c4b8d..e08f4482e3f336c74d46e2bc6e11b6428bef7a22 100644 (file)
@@ -129,15 +129,6 @@ setmetatable(cache, {
        end
 })
 
--- Syntactic sugar for TA store
-setmetatable(trust_anchors, {
-       __newindex = function (t,k,v)
-       if     k == 'file' then t.config(v)
-       elseif k == 'negative' then t.set_insecure(v)
-       else   rawset(t, k, v) end
-       end,
-})
-
 -- Register module in Lua environment
 function modules_register(module)
        -- Syntactic sugar for get() and set() properties
index efc296b82a9ffdbb721af7a8f894c5e1f1323c2b..0619d97617e8662f47af5e1308cb116715a22725 100644 (file)
@@ -19,6 +19,7 @@ end
 
 -- Fetch root anchors in XML over HTTPS, returning a zone-file-style string.
 local function bootstrap(url, ca)
+       -- RFC 7958, sec. 2, but we don't do precise XML parsing.
        -- @todo ICANN certificate is verified against current CA
        --       this is not ideal, as it should rather verify .xml signature which
        --       is signed by ICANN long-lived cert, but luasec has no PKCS7
@@ -166,7 +167,7 @@ local function refresh_plan(trust_anchors, timeout, refresh_cb, priming, bootstr
                        if trust_anchors.refresh_time ~= nil then
                                next_time = trust_anchors.refresh_time
                        end
-                       print('[ ta ] next refresh: '..next_time)
+                       print('[ ta ] next refresh in ' .. next_time/hour .. ' hours')
                        refresh_plan(trust_anchors, next_time, refresh_cb)
                        -- Priming query, prime root NS next
                        if priming ~= nil then
@@ -318,4 +319,13 @@ local trust_anchors = {
        end,
 }
 
+-- Syntactic sugar for TA store
+setmetatable(trust_anchors, {
+       __newindex = function (t,k,v)
+       if     k == 'file' then t.config(v)
+       elseif k == 'negative' then t.set_insecure(v)
+       else   rawset(t, k, v) end
+       end,
+})
+
 return trust_anchors