cache entry_list: fix crash on insertion via lua
When inserting NS or xNAME, we could get into this place with qry == NULL, and we'd crash when trying to use the memory pool. Let's simply use the stack instead.
Merge request reports
Activity
@jvcelak: I tested with code like this:
modules.unload('priming') -- annoying log burst cache.open(100*MB) cache.clear() -- not required; just practical for testing changes local ffi = require('ffi') local c = kres.context().cache ns_name = todname('ns12.example.com') local ns_addr = '\127\0\0\9' local ttl = 2^30 -- 34 years; but cache.max_ttl() will cut it down local rr = kres.rrset(ns_name, kres.type.A, kres.class.IN, ttl) assert(rr:add_rdata(ns_addr, #ns_addr)) assert(c:insert(rr, nil, ffi.C.KR_RANK_SECURE + ffi.C.KR_RANK_AUTH)) rr_ns = kres.rrset(todname('example.com'), kres.type.NS, kres.class.IN, ttl) assert(rr_ns:add_rdata(ns_name, #ns_name)) assert(c:insert(rr_ns, nil, ffi.C.KR_RANK_INSECURE + ffi.C.KR_RANK_AUTH)) c:commit()
EDIT: added
KR_RANK_AUTH
, as that might be closer to what people expect.The lower rank can be flipped to control whether the subtree is signed or not. If it is, you might want/need to insert a DS, too.
EDIT years later: factored out TTL and increased to years.
Edited by Vladimír Čunátadded 8 commits
-
be5c1633...3d62d431 - 7 commits from branch
master
- 8c655e73 - cache entry_list: fix crash on insertion via lua
-
be5c1633...3d62d431 - 7 commits from branch
added bug label
changed milestone to %4.3.0
The example above does not work for me, an explicit query for
nic.cz NS
ignores cache content:[00000.00][plan] plan 'nic.cz.' type 'NS' uid [53091.00] [53091.00][iter] 'nic.cz.' type 'NS' new uid was assigned .01, parent uid .00 [53091.01][cach] => skipping exact RR: rank 010 (min. 030), new TTL 3582
It start working if I replace
ffi.C.KR_RANK_INSECURE
withbit.bor(ffi.C.KR_RANK_AUTH, ffi.C.KR_RANK_INSECURE)
.added 15 commits
-
5aa5f573...3466da3a - 12 commits from branch
master
- 1263bc98 - cache entry_list: fix crash on insertion via lua
- 18eb1185 - cache: integration test for explicit NS insertion
- 7ed217e8 - tests: skip Deckard integration tests if sendmmsg is enabled
Toggle commit list-
5aa5f573...3466da3a - 12 commits from branch
mentioned in commit 4eaf63bc
Related: !651 (closed)
mentioned in merge request !651 (closed)
mentioned in issue #428 (closed)
mentioned in merge request !964 (merged)