Commit e29336e4 authored by Marek Vavrusa's avatar Marek Vavrusa

Bugfixes for DDNS after rrsets, dname and dname-rdata refactoring.

parent 0bc4eda4
......@@ -1203,7 +1203,7 @@ static int knot_ddns_add_rr_merge_normal(knot_rrset_t *node_rrset_copy,
}
int rdata_in_copy = knot_rrset_rdata_rr_count(*rr_copy);
int merged, deleted_rrs;
int merged = 0, deleted_rrs = 0;
int ret = knot_rrset_merge_sort(node_rrset_copy, *rr_copy, &merged,
&deleted_rrs);
dbg_ddns_detail("Merge returned: %d\n", ret);
......@@ -2040,7 +2040,7 @@ static int knot_ddns_process_rem_rrset(const knot_rrset_t *rrset,
/* 4 a) Remove redundant RRs from the ADD section of the changeset. */
knot_dname_t *owner_copy = knot_dname_copy(rrset->owner);
knot_rrset_t *empty_rrset =
knot_rrset_new(rrset->owner, type, rrset->rclass, rrset->ttl);
knot_rrset_new(owner_copy, type, rrset->rclass, rrset->ttl);
if (empty_rrset == NULL) {
knot_dname_free(&owner_copy);
return KNOT_ENOMEM;
......
......@@ -2420,6 +2420,16 @@ static void xfrin_zone_contents_free2(knot_zone_contents_t **contents)
/*----------------------------------------------------------------------------*/
static void xfrin_cleanup_old_nodes(knot_node_t *node, void *data)
{
UNUSED(data);
assert(node != NULL);
knot_node_set_new_node(node, NULL);
}
/*----------------------------------------------------------------------------*/
static void xfrin_cleanup_failed_update(knot_zone_contents_t *old_contents,
knot_zone_contents_t **new_contents)
{
......@@ -2431,6 +2441,17 @@ static void xfrin_cleanup_failed_update(knot_zone_contents_t *old_contents,
// destroy the shallow copy of zone
xfrin_zone_contents_free2(new_contents);
}
if (old_contents != NULL) {
// cleanup old zone tree - reset pointers to new node to NULL
knot_zone_contents_tree_apply_inorder(old_contents,
xfrin_cleanup_old_nodes,
NULL);
knot_zone_contents_nsec3_apply_inorder(old_contents,
xfrin_cleanup_old_nodes,
NULL);
}
}
/*----------------------------------------------------------------------------*/
......
......@@ -212,7 +212,7 @@ static int knot_zone_contents_adjust_rrsets(knot_node_t *node,
* This will be replaced with refcounting RDATA, so I'm keeping the API
* intact to ease the transition.
*/
#if 0
knot_rrset_t **rrsets = knot_node_get_rrsets_no_copy(node);
short count = knot_node_rrset_count(node);
......@@ -221,11 +221,6 @@ static int knot_zone_contents_adjust_rrsets(knot_node_t *node,
for (int r = 0; r < count; ++r) {
assert(rrsets[r] != NULL);
/* Make sure that RRSet owner is the same as node's. */
if (knot_dname_is_equal(node->owner, rrsets[r]->owner)) {
knot_rrset_set_owner(rrsets[r], node->owner);
}
dbg_zone("Adjusting next RRSet.\n");
knot_rrset_dump(rrsets[r]);
knot_zone_contents_adjust_rdata_in_rrset(rrsets[r],
......@@ -248,7 +243,6 @@ static int knot_zone_contents_adjust_rrsets(knot_node_t *node,
}
}
}
#endif
return KNOT_EOK;
}
......
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