"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/knot/updates/zone-update.c" between
knot-2.9.1.tar.xz and knot-2.9.2.tar.xz

About: Knot DNS is a high-performance authoritative-only DNS server (supports zone transfers, dynamic updates and DNSSEC).

zone-update.c  (knot-2.9.1.tar.xz):zone-update.c  (knot-2.9.2.tar.xz)
skipping to change at line 313 skipping to change at line 313
update->flags |= UPDATE_EXTRA_CHSET; update->flags |= UPDATE_EXTRA_CHSET;
return KNOT_EOK; return KNOT_EOK;
} }
const zone_node_t *zone_update_get_node(zone_update_t *update, const knot_dname_ t *dname) const zone_node_t *zone_update_get_node(zone_update_t *update, const knot_dname_ t *dname)
{ {
if (update == NULL || dname == NULL) { if (update == NULL || dname == NULL) {
return NULL; return NULL;
} }
return zone_contents_find_node(update->new_cont, dname); return zone_contents_node_or_nsec3(update->new_cont, dname);
}
const zone_node_t *zone_update_get_apex(zone_update_t *update)
{
if (update == NULL) {
return NULL;
}
return zone_update_get_node(update, update->zone->name);
} }
uint32_t zone_update_current_serial(zone_update_t *update) uint32_t zone_update_current_serial(zone_update_t *update)
{ {
const zone_node_t *apex = zone_update_get_apex(update); const zone_node_t *apex = update->new_cont->apex;
if (apex != NULL) { if (apex != NULL) {
return knot_soa_serial(node_rdataset(apex, KNOT_RRTYPE_SOA)->rdat a); return knot_soa_serial(node_rdataset(apex, KNOT_RRTYPE_SOA)->rdat a);
} else { } else {
return 0; return 0;
} }
} }
bool zone_update_changed_nsec3param(const zone_update_t *update) bool zone_update_changed_nsec3param(const zone_update_t *update)
{ {
if (update->zone->contents == NULL) { if (update->zone->contents == NULL) {
skipping to change at line 405 skipping to change at line 396
} else { } else {
apply_rollback(update->a_ctx); apply_rollback(update->a_ctx);
} }
free(update->a_ctx); free(update->a_ctx);
memset(update, 0, sizeof(*update)); memset(update, 0, sizeof(*update));
} }
static int solve_add_different_ttl(zone_update_t *update, const knot_rrset_t *ad d) static int solve_add_different_ttl(zone_update_t *update, const knot_rrset_t *ad d)
{ {
if (add->type == KNOT_RRTYPE_RRSIG) { if (add->type == KNOT_RRTYPE_RRSIG || add->type == KNOT_RRTYPE_SOA) {
return KNOT_EOK; return KNOT_EOK;
} }
const zone_node_t *exist_node = zone_contents_find_node(update->new_cont, add->owner); const zone_node_t *exist_node = zone_contents_find_node(update->new_cont, add->owner);
const knot_rrset_t exist_rr = node_rrset(exist_node, add->type); const knot_rrset_t exist_rr = node_rrset(exist_node, add->type);
if (knot_rrset_empty(&exist_rr) || exist_rr.ttl == add->ttl) { if (knot_rrset_empty(&exist_rr) || exist_rr.ttl == add->ttl) {
return KNOT_EOK; return KNOT_EOK;
} }
knot_dname_txt_storage_t buff; knot_dname_txt_storage_t buff;
skipping to change at line 548 skipping to change at line 539
return KNOT_EINVAL; return KNOT_EINVAL;
} }
} }
int zone_update_remove_rrset(zone_update_t *update, knot_dname_t *owner, uint16_ t type) int zone_update_remove_rrset(zone_update_t *update, knot_dname_t *owner, uint16_ t type)
{ {
if (update == NULL || owner == NULL) { if (update == NULL || owner == NULL) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
const zone_node_t *node = zone_contents_find_node(update->new_cont, owner ); const zone_node_t *node = zone_contents_node_or_nsec3(update->new_cont, o wner);
if (node == NULL) { if (node == NULL) {
return KNOT_ENONODE; return KNOT_ENONODE;
} }
knot_rrset_t rrset = node_rrset(node, type); knot_rrset_t rrset = node_rrset(node, type);
if (rrset.owner == NULL) { if (rrset.owner == NULL) {
return KNOT_ENOENT; return KNOT_ENOENT;
} }
return zone_update_remove(update, &rrset); return zone_update_remove(update, &rrset);
} }
int zone_update_remove_node(zone_update_t *update, const knot_dname_t *owner) int zone_update_remove_node(zone_update_t *update, const knot_dname_t *owner)
{ {
if (update == NULL || owner == NULL) { if (update == NULL || owner == NULL) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
const zone_node_t *node = zone_contents_find_node(update->new_cont, owner ); const zone_node_t *node = zone_contents_node_or_nsec3(update->new_cont, o wner);
if (node == NULL) { if (node == NULL) {
return KNOT_ENONODE; return KNOT_ENONODE;
} }
size_t rrset_count = node->rrset_count; size_t rrset_count = node->rrset_count;
for (int i = 0; i < rrset_count; ++i) { for (int i = 0; i < rrset_count; ++i) {
knot_rrset_t rrset = node_rrset_at(node, rrset_count - 1 - i); knot_rrset_t rrset = node_rrset_at(node, rrset_count - 1 - i);
int ret = zone_update_remove(update, &rrset); int ret = zone_update_remove(update, &rrset);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
skipping to change at line 599 skipping to change at line 590
} else { } else {
return zone_update_remove(update, rrset); return zone_update_remove(update, rrset);
} }
} }
int zone_update_apply_changeset(zone_update_t *update, const changeset_t *change s) int zone_update_apply_changeset(zone_update_t *update, const changeset_t *change s)
{ {
return changeset_walk(changes, update_chset_step, update); return changeset_walk(changes, update_chset_step, update);
} }
int zone_update_apply_changeset_fix(zone_update_t *update, changeset_t *changes)
{
int ret = changeset_cancelout(changes);
if (ret == KNOT_EOK) {
ret = changeset_preapply_fix(update->new_cont, changes);
}
if (ret == KNOT_EOK) {
ret = zone_update_apply_changeset(update, changes);
}
return ret;
}
int zone_update_apply_changeset_reverse(zone_update_t *update, const changeset_t *changes) int zone_update_apply_changeset_reverse(zone_update_t *update, const changeset_t *changes)
{ {
changeset_t reverse; changeset_t reverse;
reverse.remove = changes->add; reverse.remove = changes->add;
reverse.add = changes->remove; reverse.add = changes->remove;
reverse.soa_from = changes->soa_to; reverse.soa_from = changes->soa_to;
reverse.soa_to = changes->soa_from; reverse.soa_to = changes->soa_from;
return zone_update_apply_changeset(update, &reverse); return zone_update_apply_changeset(update, &reverse);
} }
static int set_new_soa(zone_update_t *update, unsigned serial_policy) static int set_new_soa(zone_update_t *update, unsigned serial_policy)
{ {
assert(update); assert(update);
knot_rrset_t *soa_cpy = node_create_rrset(zone_update_get_apex(update), knot_rrset_t *soa_cpy = node_create_rrset(update->new_cont->apex,
KNOT_RRTYPE_SOA); KNOT_RRTYPE_SOA);
if (soa_cpy == NULL) { if (soa_cpy == NULL) {
return KNOT_ENOMEM; return KNOT_ENOMEM;
} }
int ret = zone_update_remove(update, soa_cpy); int ret = zone_update_remove(update, soa_cpy);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_rrset_free(soa_cpy, NULL); knot_rrset_free(soa_cpy, NULL);
return ret; return ret;
} }
skipping to change at line 771 skipping to change at line 750
} }
int zone_update_commit(conf_t *conf, zone_update_t *update) int zone_update_commit(conf_t *conf, zone_update_t *update)
{ {
if (conf == NULL || update == NULL) { if (conf == NULL || update == NULL) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
int ret = KNOT_EOK; int ret = KNOT_EOK;
if ((update->flags & UPDATE_EXTRA_CHSET) && changeset_differs_just_serial
(&update->extra_ch)) {
changeset_t *extra_cpy = changeset_clone(&update->extra_ch);
if (extra_cpy == NULL) {
return KNOT_ENOMEM;
}
ret = zone_update_apply_changeset_reverse(update, extra_cpy);
changeset_free(extra_cpy);
if (ret != KNOT_EOK) {
return ret;
}
update->flags &= ~UPDATE_EXTRA_CHSET;
}
if (update->flags & UPDATE_INCREMENTAL) { if (update->flags & UPDATE_INCREMENTAL) {
if (changeset_empty(&update->change) && if (changeset_empty(&update->change) &&
update->zone->contents != NULL) { update->zone->contents != NULL) {
changeset_clear(&update->change); changeset_clear(&update->change);
changeset_clear(&update->extra_ch); changeset_clear(&update->extra_ch);
zone_update_clear(update); zone_update_clear(update);
return KNOT_EOK; return KNOT_EOK;
} }
ret = commit_incremental(conf, update); ret = commit_incremental(conf, update);
} else if ((update->flags & UPDATE_HYBRID)) { } else if ((update->flags & UPDATE_HYBRID)) {
 End of changes. 8 change blocks. 
41 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)