Commit 89dead74 authored by Jan Kadlec's avatar Jan Kadlec

Fixed condition in RRSIG solving + code rearangments.

parent 9aa158ac
......@@ -815,7 +815,7 @@ int nsec_append_rrsigs(knot_pkt_t *pkt, bool optional)
if (section->rrinfo[i].rrsigs) {
knot_rrset_t *synth_sig = NULL;
ret = knot_rrset_synth_rrsig(rr, section->rrinfo[i].rrsigs, &synth_sig, &pkt->mm);
if (ret != KNOT_EOK || ret != KNOT_ENOENT) {
if (ret != KNOT_EOK && ret != KNOT_ENOENT) {
break;
}
ret = knot_pkt_put(pkt, compr_hint, synth_sig, NULL, flags);
......
......@@ -725,18 +725,17 @@ static int insert_rr(knot_zone_contents_t *z, knot_rrset_t *rr, knot_node_t **n,
return knot_node_add_rrset(*n, rr);
}
int knot_zone_contents_add_nsec3_rr(knot_zone_contents_t *z,
knot_rrset_t *rr, knot_node_t **n)
static bool to_nsec3_tree(const knot_rrset_t *rr)
{
const bool nsec3 = true;
return insert_rr(z, rr, n, nsec3);
return rr->type == KNOT_RRTYPE_NSEC3 ||
(rr->type == KNOT_RRTYPE_RRSIG &&
knot_rdata_rrsig_type_covered(rr, 0) == KNOT_RRTYPE_NSEC3);
}
int knot_zone_contents_add_rr(knot_zone_contents_t *z,
knot_rrset_t *rr, knot_node_t **n)
{
const bool nsec3 = false;
return insert_rr(z, rr, n, nsec3);
return insert_rr(z, rr, n, to_nsec3_tree(rr));
}
int knot_zone_contents_add_rrset(knot_zone_contents_t *zone,
......
......@@ -133,8 +133,6 @@ int knot_zone_contents_create_node(knot_zone_contents_t *contents,
const knot_rrset_t *rr,
knot_node_t **node);
int knot_zone_contents_add_nsec3_rr(knot_zone_contents_t *z,
knot_rrset_t *rr, knot_node_t **n);
int knot_zone_contents_add_rr(knot_zone_contents_t *z,
knot_rrset_t *rr, knot_node_t **n);
......
......@@ -75,24 +75,12 @@ static int add_rdata_to_rr(knot_rrset_t *rrset, const scanner_t *scanner)
return KNOT_EOK;
}
static bool to_nsec3_tree(const knot_rrset_t *rr)
{
return rr->type == KNOT_RRTYPE_NSEC3 ||
(rr->type == KNOT_RRTYPE_RRSIG &&
knot_rdata_rrsig_type_covered(rr, 0) == KNOT_RRTYPE_NSEC3);
}
static int zone_loader_step(zone_loader_t *zl, knot_rrset_t *rr)
{
assert(zl && rr);
knot_node_t *n = NULL;
int ret = KNOT_EOK;
if (!to_nsec3_tree(rr)) {
ret = knot_zone_contents_add_rr(zl->z, rr, &n);
} else {
ret = knot_zone_contents_add_nsec3_rr(zl->z, rr, &n);
}
int ret = knot_zone_contents_add_rr(zl->z, rr, &n);
if (ret < 0) {
return ret;
} else if (ret > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment