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)
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')
-- 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}
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...
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