From: Vladimír Čunát Date: Thu, 30 Jul 2026 12:24:21 +0000 (+0200) Subject: lib/rules: log more info for a MDB_BAD_VALSIZE case X-Git-Tag: v6.4.2~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fd85ffd3ecedda7ecd08e245a857bfe55a64227;p=thirdparty%2Fknot-resolver.git lib/rules: log more info for a MDB_BAD_VALSIZE case Issue 956: it's not difficult to run into this limit, e.g. by using blocking style with hosts-like files pointing names to 127.0.0.1. Now it additionally explains a little, e.g.: [rules ] records too big (512 B) for 1.0.0.127.in-addr.arpa. PTR --- diff --git a/lib/rules/api.c b/lib/rules/api.c index 679fee637..7a57aad9d 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -8,6 +8,7 @@ #include "lib/cache/cdb_lmdb.h" #include +#include struct kr_rules *the_rules = NULL; @@ -635,8 +636,15 @@ int local_data_ins(knot_db_val_t key, const knot_rrset_t *rrs, const knot_rdatas knot_db_val_t val = { .data = buf, .len = val_len }; int ret = ruledb_op(write, &key, &val, 1); // TODO: overwriting on ==tags? - // ENOSPC seems to be the only expectable error. - kr_assert(ret == 0 || ret == kr_error(ENOSPC)); + if (unlikely(ret == MDB_BAD_VALSIZE)) { // yeah, leaking implementation details + KR_DNAME_GET_STR(owner_str, rrs->owner); + KR_RRTYPE_GET_STR(type_str, rrs->type); + kr_log_error(RULES, "records too big (%d B) for %s %s\n", + val_len, owner_str, type_str); + } else { + // ENOSPC seems to be the only other expectable error. + kr_assert(ret == 0 || ret == kr_error(ENOSPC)); + } if (ret || rrs->type != KNOT_RRTYPE_DNAME) return ret;