These are chat archives for CZ-NIC/knot-resolver

30th
May 2017
Mike Emigh
@nakame_maiku_twitter
May 30 2017 07:02
luajit 2.1-beta3 is supported, correct?
Mike Emigh
@nakame_maiku_twitter
May 30 2017 07:13
include/luajit-2.1/lauxlib.h:88:18: note: previous declaration of 'luaL_setfuncs' was here
 LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
                  ^
gmake: *** [daemon/daemon.mk:43: daemon/engine.o] Error 1
I have that problem with 2.1, but it looks like the docker image uses 2.1
Mike Emigh
@nakame_maiku_twitter
May 30 2017 07:55
a ha, found the commit that fixes it in master
Vladimír Čunát
@vcunat
May 30 2017 08:01
Right :-)
Mike Emigh
@nakame_maiku_twitter
May 30 2017 08:39
I've got this weird problem where I can add domains to the list of domains for views
but I've a load that table from a file, it panis
pics
panics
PANIC: unprotected error in call to Lua API (8)
local file = "/etc/kresd/ads.zone"
local arr = {}
for line in io.lines(file) do
    --table.insert(arr, line)
    arr[#arr + 1] = line
end
--file:close()
print("here")
--print(arr[1])
local arr2 = {}
for i = 1, #arr do
    --print(arr[i])
    io.write(string.format("domain: %s", arr[i]))
    print(#arr[i])
end
print(#arr)
arr2[1] = todname('blah\n')
arr2[2] = todname('my.test.')
local sdf = 'sdf'
table.insert(arr2, todname('my.test'))
table.insert(arr2, todname 'blah3')
table.insert(arr2, todname(sdf))
view:addr('10.10.10.14', policy.suffix(policy.DENY, arr))
if I change that last line to arr2 instead of arr, it works fine
any idea why creating the table from the file causes a panic when adding to the view?
fails inside the aho-corasick module
Vladimír Čunát
@vcunat
May 30 2017 08:46
No immediate ideas. Sounds like some bug in that module.
Mike Emigh
@nakame_maiku_twitter
May 30 2017 08:47
looks like they may have improved their implementation https://github.com/cloudflare/lua-aho-corasick
not pure lua now
Mike Emigh
@nakame_maiku_twitter
May 30 2017 09:05
I'm going to attempt to compile and use that, I'll let you know if it works
Vladimír Čunát
@vcunat
May 30 2017 09:06
Great. We can't give much time into it at this moment.
Mike Emigh
@nakame_maiku_twitter
May 30 2017 10:05
newer module works with a small change to policy.suffix
function policy.suffix(action, zone_list)
        local AC = require('ahocorasick')
        local tree = AC.create(zone_list)

        return function(req, query)
                local match = AC.match(tree, query:name(), false)
                if match ~= nil then
                        return action
                end
                return nil
        end
end
working function
Vladimír Čunát
@vcunat
May 30 2017 10:14
And the update fixed that panic problem, right? (besides the expected performance gains)
Mike Emigh
@nakame_maiku_twitter
May 30 2017 10:29
yep