Knot resolver does not honor custom.conf anymore after update


After the latest update it looks like my custom kresd script is no longer executed or fails silently because of errors. “” is no longer resolved by my TO. It was resolved yesterday, before I restarted my TO.

I have this in my /etc/kresd/custom.conf:

local function genRR (state, req)
        local answer = req.answer
        local qry = req:current()
        if qry.stype ~= kres.type.A then
                return state
        answer:put(qry.sname, 900, answer:qclass(), kres.type.A, '\192\168\1\108')
        return kres.DONE

local internal_server = policy.add(policy.suffix(genRR, { todname('') }

custom.conf is mentioned also in my /etc/config/resolver


  1. What changed during the update
  2. How can I debug this?
  3. How can it be fixed?

You (now) need to add this line to the beginning.

local ffi = require('ffi')

I’m sorry that the removal of this symbol from globals was a user-facing change, really.

(The missing closing parenthesis in your last line are just forum typo, I expect.)

That did it. Thanks! But please put these changes in the release notes.

I’m trying to put the more important changes (for users) to release notes (in upstream knot-resolver project). In this case – AFAIK it’s very rare to use ffi in configs. I want to avoid putting too much in the notes, as that would make them hard to read and there’s git log for anyone ready to read such long lists.

In case you still use a function similar to what you posted, see Kresd crashes with policy configuration and FQDN as router name

I did, see my answer in the other post @vcunat.

Is there a “better” solution to this?