]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
ranked rrarray: don't merge RRSIGs of different types
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 19 May 2017 12:59:39 +0000 (14:59 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 19 May 2017 13:04:33 +0000 (15:04 +0200)
For example, kr_rrmap_add has been relying on sets covering just a
single type (for years).  It's used by cache and there it's required to
store types separately.

It seems all other parts of code should be just OK with this.

lib/utils.c

index c528c6dd4079857836ae2ff2438de7a2da458e93..99d9398eb64d7fe9174f28b870f0f2f6ad485b6f 100644 (file)
@@ -486,6 +486,13 @@ int kr_ranked_rrarray_add(ranked_rr_array_t *array, const knot_rrset_t *rr,
                if (stashed->rr->rclass == rr->rclass &&
                    stashed->rr->type == rr->type &&
                    knot_dname_is_equal(stashed->rr->owner, rr->owner)) {
+                       /* Don't merge RRSIGs covering different types.
+                        * Cache-related code relies on that. */
+                       if (rr->type == KNOT_RRTYPE_RRSIG &&
+                           knot_rrsig_type_covered(&rr->rrs, 0)
+                                       != knot_rrsig_type_covered(&stashed->rr->rrs, 0)) {
+                               continue;
+                       }
                        assert(stashed->rank == rank &&
                               stashed->cached == false &&
                               stashed->to_wire == to_wire);