]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lua: remove some compatibility code
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 1 Aug 2017 16:15:52 +0000 (18:15 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 1 Aug 2017 16:28:21 +0000 (18:28 +0200)
NEWS
daemon/lua/kres.lua.in
modules/dns64/dns64.lua

diff --git a/NEWS b/NEWS
index 1a8c1ec53d6b01770f4d3f29710139cb21a4551c..a0c33843e8666910d1d935bf4c7dec7dd5680939 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,11 +3,10 @@ Knot Resolver 1.4.0 (2017-0x-yy)
 
 Incompatible changes
 --------------------
-
 - lua: query flag-sets are no longer represented as plain integers.
-  Using bit operations directly on kres.query.* no longer works,
-  but other use cases should work as before.  Still, it is recommended
-  to instead write code like qry.flags.NO_0X20 = true.
+  kres.query.* no longer works, and kr_query_t lost trivial methods
+  'hasflag' and 'resolved'.
+  You can instead write code like qry.flags.NO_0X20 = true.
 
 
 Knot Resolver 1.3.2 (2017-07-28)
index bb7a3648fe77bc1a04f15fa82e64adab965b134e..c42567e04bfa67ce8d3b0ee673b518a8cc70d5c8 100644 (file)
@@ -252,16 +252,8 @@ 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,
-               -- legacy functions
-               hasflag = function(qry, flag) -- Note: `flag` is now a string - flag name.
-                       return qry.flags[flag]
-               end,
-               resolved = function(qry)
-                       return qry.flags.RESOLVED
-               end,
-
                final = function(qry)
-                       return qry:resolved() and (qry.parent == nil)
+                       return qry.flags.RESOLVED and (qry.parent == nil)
                end,
                nslist = function(qry, list)
                        assert(#list <= 4, 'maximum of 4 addresses can be evaluated for each query')
@@ -350,8 +342,7 @@ kres = {
        -- Create a struct kr_qflags from a single flag name or a list of names.
        mk_qflags = function (names)
                local kr_qflags = ffi.typeof('struct kr_qflags')
-               -- compat. hacks
-               if names == 0 or names == nil then
+               if names == 0 or names == nil then -- compatibility: nil is common in lua
                        names = {}
                elseif type(names) == 'string' then
                        names = {names}
@@ -365,9 +356,6 @@ kres = {
                end
                return fs
        end,
-       -- Don't use anymore - compat. hack: :hasflag() etc. now accept string names
-       -- but bit operations won't work.
-       query = setmetatable({}, { __index = function (t, name) return name end }),
 
        CONSUME = 1, PRODUCE = 2, DONE = 4, FAIL = 8, YIELD = 16,
        -- Metatypes.  Beware that any pointer will be cast silently...
index fd299b77ff0e8029976325b254a3a95b4fcecbd4..2e4266df32f31cf79734663fd12c8043f565cc91 100644 (file)
@@ -17,7 +17,7 @@ mod.layer = {
                req = kres.request_t(req)
                qry = req:current()
                -- Observe only authoritative answers
-               if mod.proxy == nil or not qry:resolved() then
+               if mod.proxy == nil or not qry.flags.RESOLVED then
                        return state
                end
                -- Synthetic AAAA from marked A responses