]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: consider only distance between cut-nonterm
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 24 Oct 2015 10:05:35 +0000 (12:05 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 24 Oct 2015 10:05:35 +0000 (12:05 +0200)
lib/resolve.c

index 1b299586fd07137da3587f86f782cce34c2dbe33..e8df821ef4bcb26ab574e797926c0972a0aa54db 100644 (file)
@@ -133,12 +133,12 @@ static void check_empty_nonterms(struct kr_query *qry, knot_pkt_t *pkt, struct k
        const knot_dname_t *target = qry->sname;
        const knot_dname_t *cut_name = qry->zone_cut.name;
        struct kr_cache_entry *entry = NULL;
-       /* @note: The non-terminal must be direct child of zone cut (e.g. label distance == 2),
-        *        otherwise this would risk leaking information to parent if the NODATA TTD > zone cut TTD.
-        */
+       /* @note: The non-terminal must be direct child of zone cut (e.g. label distance <= 2),
+        *        otherwise this would risk leaking information to parent if the NODATA TTD > zone cut TTD. */
        size_t labels = knot_dname_labels(target, NULL) - knot_dname_labels(cut_name, NULL);
-       if (labels > 2) {
-               return;
+       while (labels > 2) {
+               target = knot_wire_next_label(target, NULL);
+               --labels;
        }
        for (size_t i = 0; i < labels; ++i) {
                int ret = kr_cache_peek(txn, KR_CACHE_PKT, target, KNOT_RRTYPE_NS, &entry, &timestamp);