]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lua: remove :nslist from kr_query_t
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 1 Aug 2017 16:38:42 +0000 (18:38 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 1 Aug 2017 16:41:10 +0000 (18:41 +0200)
It was rather low-level anyway.

daemon/lua/kres.lua.in
modules/policy/policy.lua

index dee3efe7f1eadbdf1d020f3edd36a4fabf491588..ebf5ff259e6b010160e463825cb4f2d8e37bab55 100644 (file)
@@ -252,16 +252,6 @@ local kr_query_t = ffi.typeof('struct kr_query')
 ffi.metatype( kr_query_t, {
        __index = {
                name = function(qry) return ffi.string(qry.sname, knot.knot_dname_size(qry.sname)) end,
-               nslist = function(qry, list)
-                       assert(#list <= 4, 'maximum of 4 addresses can be evaluated for each query')
-                       for i, ns in ipairs(list) do
-                               assert(C.kr_nsrep_set(qry, i - 1, ns) == 0);
-                       end
-                       -- If less than maximum NSs, insert guard to terminate the list
-                       if #list < 4 then
-                               assert(C.kr_nsrep_set(qry, #list, nil) == 0);
-                       end
-               end,
        },
 })
 -- Metatype for request
index c9585ef6e098e307954052118761e942dd3bf146..10aeb64b452928ddbba7011bba3c17b850515f89 100644 (file)
@@ -63,6 +63,17 @@ local function mirror(target)
        end
 end
 
+-- Override the list of nameservers (forwarders)
+local function set_nslist(qry, list)
+       for i, ns in ipairs(list) do
+               assert(ffi.C.kr_nsrep_set(qry, i - 1, ns) == 0);
+       end
+       -- If less than maximum NSs, insert guard to terminate the list
+       if #list < 4 then
+               assert(ffi.C.kr_nsrep_set(qry, #list, nil) == 0);
+       end
+end
+
 -- Forward request, and solve as stub query
 local function stub(target)
        local list = {}
@@ -79,7 +90,7 @@ local function stub(target)
                -- Switch mode to stub resolver, do not track origin zone cut since it's not real authority NS
                qry.flags.STUB = true
                qry.flags.ALWAYS_CUT = false
-               qry:nslist(list)
+               set_nslist(qry, list)
                return state
        end
 end
@@ -103,7 +114,7 @@ local function forward(target)
                qry.flags.ALWAYS_CUT = false
                qry.flags.NO_MINIMIZE = true
                qry.flags.AWAIT_CUT = true
-               qry:nslist(list)
+               set_nslist(qry, list)
                return state
        end
 end