}
-
+/** It's simply inside of cycle taken out to decrease indentation. \return error code. */
static int stash_rrset(const ranked_rr_array_t *arr, int arr_i, uint32_t min_ttl,
const struct kr_query *qry, struct kr_cache *cache);
/* TODO: probably safe to break but maybe not worth it */
}
ret = stash_rrset(arr, i, min_ttl, qry, cache);
- if (ret) goto finally;
+ if (ret) {
+ VERBOSE_MSG(qry, "=> stashing RRs errored out\n");
+ goto finally;
+ }
/* LATER(optim.): maybe filter out some type-rank combinations
* that won't be useful as separate RRsets. */
}
return ctx->state; /* we ignore cache-stashing errors */
}
-
-
-/** It's simply inside of cycle taken out to decrease indentation.
- * \return kr_ok() or KR_STATE_FAIL */
static int stash_rrset(const ranked_rr_array_t *arr, int arr_i, uint32_t min_ttl,
const struct kr_query *qry, struct kr_cache *cache)
{
}
const knot_rrset_t *rr = entry->rr;
if (!rr) {
- assert(false);
- return KR_STATE_FAIL;
+ assert(!EINVAL);
+ return kr_error(EINVAL);
}
if (!check_dname_for_lf(rr->owner)) {
WITH_VERBOSE {
return kr_ok();
}
+ #if 0
WITH_VERBOSE {
VERBOSE_MSG(qry, "=> considering to stash ");
kr_rrtype_print(rr->type, "", " ");
kr_dname_print(rr->owner, "", "\n");
}
+ #endif
switch (rr->type) {
case KNOT_RRTYPE_RRSIG:
bool is_wild = knot_rrsig_labels(&e->rr->rrs, 0)
!= knot_dname_labels(e->rr->owner, NULL);
if (is_wild) {
- VERBOSE_MSG(qry, " 2\n");
return kr_ok(); // FIXME, especially for NSEC1!
}
rr_sigs = e->rr;
return kr_ok();
}
if (!rr_sigs || !rr_sigs->rrs.rr_count || !rr_sigs->rrs.data) {
- assert(false);
- return KR_STATE_FAIL;
+ assert(!EINVAL);
+ return kr_error(EINVAL);
}
k->zlf_len = knot_dname_size(knot_rrsig_signer_name(&rr_sigs->rrs, 0)) - 1;
key = key_NSEC1(k, rr->owner, false);
default:
ret = kr_dname_lf(k->buf, rr->owner, NULL);
if (ret) {
- VERBOSE_MSG(qry, " 3\n");
- return KR_STATE_FAIL;
+ assert(!ret);
+ return kr_error(ret);
}
key = key_exact_type(k, rr->type);
}
+/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
#include "lib/module.h"
#include "lib/cache.h"
-
/** Module implementation. */
const kr_layer_api_t *cache_lmdb_layer(struct kr_module *module)
{