]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rrcache: break caching if target already exists (catches loops)
authorMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 19 May 2015 17:07:39 +0000 (19:07 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 19 May 2015 20:55:05 +0000 (22:55 +0200)
lib/layer/rrcache.c

index ea885b6135df86d1dab8a726647766d35fa374b0..7722320bdad993dc90832cbbd7fba77f84620fe8 100644 (file)
@@ -174,7 +174,10 @@ static int write_cache_rr(const knot_pktsection_t *section, knot_rrset_t *rr, na
                /* Follow the chain */
                rr->owner = (knot_dname_t *)knot_ns_name(&rr->rrs, 0);
                knot_rdataset_clear(&rr->rrs, pool);
-
+               /* Check if target already cached. */
+               if (kr_cache_peek_rr(txn, rr, &timestamp) == KNOT_EOK) {
+                       break;
+               }
        }
 
        /* Now there may be a terminal record. */