From ac9d08b9f8b59e46813cf1285e53223242be2577 Mon Sep 17 00:00:00 2001 From: Lubos Slovak <lubos.slovak@nic.cz> Date: Thu, 19 Jul 2012 10:29:35 +0200 Subject: [PATCH] Fixed merging to stub RRSet in IXFR-in. - If all RDATA have been removed from a RRSet, but the RRSet was not removed because RRSIGs remained, and new RDATA added to this RRSet had different TTL, the TTL from the old RRSet was used. This was fixed by rewriting the TTL by the TTL fo the new RRSet. refs @1963 @30m --- src/libknot/updates/xfr-in.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c index 975f702f21..6eee7c8bbb 100644 --- a/src/libknot/updates/xfr-in.c +++ b/src/libknot/updates/xfr-in.c @@ -2000,6 +2000,16 @@ dbg_xfrin_exec_detail( dbg_xfrin_detail("RDATA in RRSet1: %p, RDATA in RRSet2: %p\n", (*rrset)->rdata, add->rdata); + /* In case the RRSet is empty (and only remained there because of the + * RRSIGs, it may happen that the TTL may be different than that of + * the new RRs. Update the TTL according to the first RR. + */ + + if (knot_rrset_rdata(*rrset) == NULL + && knot_rrset_ttl(*rrset) != knot_rrset_ttl(add)) { + knot_rrset_set_ttl(*rrset, knot_rrset_ttl(add)); + } + ret = knot_rrset_merge((void **)rrset, (void **)&add); if (ret != KNOT_EOK) { dbg_xfrin("Failed to merge changeset RRSet.\n"); -- GitLab