Skip to content
Snippets Groups Projects
Commit b4ff623a authored by Daniel Salzman's avatar Daniel Salzman
Browse files

refresh: reset TCP connection when fallback from IXFR to AXFR

parent 5c9250ef
No related branches found
No related tags found
No related merge requests found
......@@ -835,6 +835,7 @@ static int transfer_consume(knot_layer_t *layer, knot_pkt_t *pkt)
REFRESH_LOG(LOG_WARNING, data->zone->name, data->remote,
"fallback to AXFR");
ixfr_cleanup(data);
layer->flags |= KNOT_RQ_LAYER_CLOSE;
data->xfr_type = XFR_TYPE_AXFR;
return KNOT_STATE_RESET;
}
......
......@@ -48,6 +48,7 @@ struct knot_layer {
void *data; //!< Module specific.
const struct knot_layer_api *api;
tsig_ctx_t *tsig; //!< TODO: remove
unsigned flags; //!< Custom flags.
};
/*! \brief Packet processing module API. */
......
......@@ -197,6 +197,14 @@ static int request_reset(struct knot_requestor *req,
knot_layer_reset(&req->layer);
tsig_reset(&last->tsig);
if (req->layer.flags & KNOT_RQ_LAYER_CLOSE) {
req->layer.flags &= ~KNOT_RQ_LAYER_CLOSE;
if (last->fd >= 0) {
close(last->fd);
last->fd = -1;
}
}
if (req->layer.state == KNOT_STATE_RESET) {
return KNOT_LAYER_ERROR;
}
......
......@@ -31,6 +31,10 @@ enum {
KNOT_RQ_UDP = 1 << 0 /* Use UDP for requests. */
};
enum {
KNOT_RQ_LAYER_CLOSE = 1 << 0
};
/*! \brief Requestor structure.
*
* Requestor holds a FIFO of pending queries.
......@@ -48,7 +52,6 @@ struct knot_request {
knot_pkt_t *query;
knot_pkt_t *resp;
tsig_ctx_t tsig;
knot_layer_t layer;
knot_sign_context_t sign; /* TODO: Remove. Used in updates only, should
be part of the zone update 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