Skip to content
Snippets Groups Projects
Commit 7c7236c2 authored by Jan Kadlec's avatar Jan Kadlec
Browse files

IXFR: AXFR-style IXFR client side handling

parent 6d33c58e
No related branches found
No related tags found
1 merge request!280Axfr ixfr client
......@@ -679,14 +679,17 @@ int ixfr_process_answer(knot_pkt_t *pkt, struct answer_data *adata)
return NS_PROC_FAIL;
}
if (!ixfr_enough_data(pkt)) {
return NS_PROC_FAIL;
}
if (adata->ext == NULL) {
if (!ixfr_enough_data(pkt)) {
return NS_PROC_FAIL;
}
/* Check for AXFR-style IXFR. */
if (ixfr_is_axfr(pkt)) {
IXFRIN_LOG(LOG_NOTICE, "fallback to AXFR");
return axfr_answer_process(pkt, adata);
/* Check for AXFR-style IXFR. */
if (ixfr_is_axfr(pkt)) {
IXFRIN_LOG(LOG_NOTICE, "receiving AXFR-style IXFR");
adata->response_type = KNOT_RESPONSE_AXFR;
return axfr_answer_process(pkt, adata);
}
}
/* Check RCODE. */
......
......@@ -22,12 +22,14 @@
/*! \brief Accessor to query-specific data. */
#define ANSWER_DATA(ctx) ((struct answer_data *)(ctx)->data)
#define RESPONSE_TYPE_UNSET -1
static void answer_data_init(knot_process_t *ctx, void *module_param)
{
/* Initialize persistent data. */
struct answer_data *data = ANSWER_DATA(ctx);
memset(data, 0, sizeof(struct answer_data));
data->response_type = RESPONSE_TYPE_UNSET;
data->mm = &ctx->mm;
data->param = module_param;
}
......@@ -119,9 +121,11 @@ static int process_answer(knot_pkt_t *pkt, knot_process_t *ctx)
/* Call appropriate processing handler. */
int next_state = NS_PROC_NOOP;
int response_type = knot_pkt_type(query) | KNOT_RESPONSE;
/* @note We can't derive type from response, as it may not contain QUESTION at all. */
switch(response_type) {
if (data->response_type == RESPONSE_TYPE_UNSET) {
/* @note We can't derive type from response, as it may not contain QUESTION at all. */
data->response_type = knot_pkt_type(query) | KNOT_RESPONSE;
}
switch(data->response_type) {
case KNOT_RESPONSE_NORMAL:
next_state = internet_process_answer(pkt, data);
break;
......
......@@ -59,6 +59,7 @@ struct answer_data {
knot_sign_context_t sign; /*!< Signing context. */
/* Everything below should be kept on reset. */
int response_type; /*!< Type of incoming response. */
struct process_answer_param *param; /*!< Module parameters. */
mm_ctx_t *mm; /*!< Memory context. */
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment