Skip to content
Snippets Groups Projects
Commit 39e447e4 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman
Browse files

ixfr/axfr: failover even when the ixfr reply wasn't valid

before: ixfr falls back to axfr only if valid, but negative reply, e.g. NOTAUTH, journal inconsistency..
after: ixfr falls back to axfr in any case ixfr fails, e.g. malformed reply packet
parent bc4d8f19
No related branches found
No related tags found
1 merge request!938ixfr/axfr: failover even when the ixfr reply wasn't valid
Pipeline #41367 passed with warnings
......@@ -405,6 +405,7 @@ static void ixfr_cleanup(struct refresh_data *data)
}
knot_rrset_free(data->ixfr.final_soa, data->mm);
data->ixfr.final_soa = NULL;
mm_free(data->mm, data->ixfr.proc);
data->ixfr.proc = NULL;
......@@ -952,16 +953,6 @@ static int transfer_consume(knot_layer_t *layer, knot_pkt_t *pkt)
}
}
// IXFR to AXFR failover
if (data->xfr_type == XFR_TYPE_IXFR && next == KNOT_STATE_FAIL) {
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;
}
return next;
}
......@@ -1087,7 +1078,18 @@ static int try_refresh(conf_t *conf, zone_t *zone, const conf_remote_t *master,
int timeout = conf->cache.srv_tcp_reply_timeout * 1000;
int ret = knot_requestor_exec(&requestor, req, timeout);
int ret;
// while loop runs 0x or 1x; IXFR to AXFR failover
while ((ret = knot_requestor_exec(&requestor, req, timeout)) != KNOT_EOK &&
data.xfr_type == XFR_TYPE_IXFR) {
REFRESH_LOG(LOG_WARNING, data.zone->name, data.remote,
"fallback to AXFR");
ixfr_cleanup(&data);
data.xfr_type = XFR_TYPE_AXFR;
requestor.layer.state = KNOT_STATE_RESET;
requestor.layer.flags |= KNOT_RQ_LAYER_CLOSE;
}
knot_request_free(req, NULL);
knot_requestor_clear(&requestor);
......
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