Knot resolver does not honor custom.conf anymore after update

Hello,

After the latest update it looks like my custom kresd script is no longer executed or fails silently because of errors. “hal2100.one” 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
        end
        ffi.C.kr_pkt_make_auth_header(answer)
        answer:rcode(kres.rcode.NOERROR)
        answer:begin(kres.section.ANSWER)
        answer:put(qry.sname, 900, answer:qclass(), kres.type.A, '\192\168\1\108')
        return kres.DONE
end

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

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

So:

  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?