Commit c2131e6a authored by Marek Vavruša's avatar Marek Vavruša

cleanup

parent 709a3d7d
...@@ -914,7 +914,7 @@ int internet_query_plan(struct query_plan *plan) ...@@ -914,7 +914,7 @@ int internet_query_plan(struct query_plan *plan)
} }
/*! \brief Process answer to SOA query. */ /*! \brief Process answer to SOA query. */
static int internet_answer_soa(knot_pkt_t *pkt, struct answer_data *data) static int process_soa_answer(knot_pkt_t *pkt, struct answer_data *data)
{ {
zone_t *zone = data->param->zone; zone_t *zone = data->param->zone;
...@@ -957,7 +957,7 @@ int internet_process_answer(knot_pkt_t *pkt, struct answer_data *data) ...@@ -957,7 +957,7 @@ int internet_process_answer(knot_pkt_t *pkt, struct answer_data *data)
/* As of now, server can only issue SOA queries. */ /* As of now, server can only issue SOA queries. */
switch(knot_pkt_qtype(pkt)) { switch(knot_pkt_qtype(pkt)) {
case KNOT_RRTYPE_SOA: case KNOT_RRTYPE_SOA:
return internet_answer_soa(pkt, data); return process_soa_answer(pkt, data);
default: default:
return NS_PROC_NOOP; return NS_PROC_NOOP;
} }
......
...@@ -203,8 +203,7 @@ static int apply_remove(zone_contents_t *contents, changeset_t *chset) ...@@ -203,8 +203,7 @@ static int apply_remove(zone_contents_t *contents, changeset_t *chset)
const knot_rrset_t *rr = rr_node->rr; const knot_rrset_t *rr = rr_node->rr;
// Find node for this owner // Find node for this owner
zone_node_t *node = zone_contents_find_node_for_rr(contents, zone_node_t *node = zone_contents_find_node_for_rr(contents, rr);
rr);
if (!can_remove(node, rr)) { if (!can_remove(node, rr)) {
// Nothing to remove from, skip. // Nothing to remove from, skip.
continue; continue;
...@@ -364,13 +363,12 @@ static int mark_empty(zone_node_t **node_p, void *data) ...@@ -364,13 +363,12 @@ static int mark_empty(zone_node_t **node_p, void *data)
return KNOT_EOK; return KNOT_EOK;
} }
/*! \brief Removes node that were previously marked as empty. */ static int remove_empty_tree_nodes(zone_tree_t *tree)
static int remove_empty_nodes(zone_contents_t *z)
{ {
list_t l; list_t l;
init_list(&l); init_list(&l);
// walk through the zone and select nodes to be removed // walk through the zone and select nodes to be removed
int ret = zone_tree_apply(z->nodes, mark_empty, &l); int ret = zone_tree_apply(tree, mark_empty, &l);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
} }
...@@ -379,7 +377,7 @@ static int remove_empty_nodes(zone_contents_t *z) ...@@ -379,7 +377,7 @@ static int remove_empty_nodes(zone_contents_t *z)
node_t *nxt = NULL; node_t *nxt = NULL;
WALK_LIST_DELSAFE(n, nxt, l) { WALK_LIST_DELSAFE(n, nxt, l) {
zone_node_t *node = (zone_node_t *)n->d; zone_node_t *node = (zone_node_t *)n->d;
ret = zone_contents_remove_node(z, node->owner); int ret = zone_tree_remove(tree, node->owner, &node);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
} }
...@@ -387,24 +385,18 @@ static int remove_empty_nodes(zone_contents_t *z) ...@@ -387,24 +385,18 @@ static int remove_empty_nodes(zone_contents_t *z)
free(n); free(n);
} }
init_list(&l); return KNOT_EOK;
// Do the same with NSEC3 nodes. }
ret = zone_tree_apply(z->nsec3_nodes, mark_empty, &l);
/*! \brief Removes node that were previously marked as empty. */
static int remove_empty_nodes(zone_contents_t *z)
{
int ret = remove_empty_tree_nodes(z->nodes);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
} }
WALK_LIST_DELSAFE(n, nxt, l) { return remove_empty_tree_nodes(z->nsec3_nodes);
zone_node_t *node = (zone_node_t *)n->d;
ret = zone_contents_remove_nsec3_node(z, node->owner);
if (ret != KNOT_EOK) {
return ret;
}
node_free(&node);
free(n);
}
return KNOT_EOK;
} }
/* --------------------- Zone copy and finalization ------------------------- */ /* --------------------- Zone copy and finalization ------------------------- */
......
...@@ -51,9 +51,7 @@ int apply_changesets(zone_t *zone, changesets_t *chsets, ...@@ -51,9 +51,7 @@ int apply_changesets(zone_t *zone, changesets_t *chsets,
* \param contents Zone contents to apply the changesets to. Will be modified. * \param contents Zone contents to apply the changesets to. Will be modified.
* \param chsets Changesets to be applied to the zone. * \param chsets Changesets to be applied to the zone.
* *
* \retval KNOT_EOK if successful. * \return KNOT_E*
* \retval KNOT_EINVAL if given one of the arguments is NULL.
* \return Other error code if the application went wrong.
*/ */
int apply_changesets_directly(zone_contents_t *contents, int apply_changesets_directly(zone_contents_t *contents,
changesets_t *chsets); changesets_t *chsets);
......
...@@ -150,8 +150,7 @@ int main(int argc, char *argv[]) ...@@ -150,8 +150,7 @@ int main(int argc, char *argv[])
/* Test requestor in connected environment. */ /* Test requestor in connected environment. */
test_connected(&requestor, &remote); test_connected(&requestor, &remote);
/* TSIG secured. */ /*! \todo #243 TSIG secured requests test should be implemented. */
#warning TODO: when ported sign_packet/verify_packet
/* Terminate responder. */ /* Terminate responder. */
int responder = net_connected_socket(SOCK_STREAM, &remote.addr, NULL, 0); int responder = net_connected_socket(SOCK_STREAM, &remote.addr, NULL, 0);
......
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