Skip to content
Snippets Groups Projects
Verified Commit 8a659165 authored by Petr Špaček's avatar Petr Špaček
Browse files

prefill/zimport: fix race condition on TA access

TA RRset might change asynchronously between zi_zone_import() and
zi_zone_process(), we cannot rely pointer from zi_zone_import().
parent 60129bbd
No related branches found
No related tags found
1 merge request!983prefill/zimport: fix race condition on TA access
Pipeline #62648 canceled
......@@ -494,6 +494,15 @@ static void zi_zone_process(uv_timer_t* handle)
}
z_import->key = rr_key;
map_t *trust_anchors = &z_import->worker->engine->resolver.trust_anchors;
knot_rrset_t *rr_ta = kr_ta_get(trust_anchors, z_import->origin);
if (!rr_ta) {
kr_log_error("[zimport] error: TA vanished in middle of import");
failed = 1;
goto finish;
}
z_import->ta = rr_ta;
VERBOSE_MSG(NULL, "started: zone: '%s'\n", zone_name_str);
z_import->start_timestamp = kr_now();
......@@ -770,9 +779,7 @@ int zi_zone_import(struct zone_import_ctx *z_import,
/* Try to find TA for worker->z_import.origin. */
map_t *trust_anchors = &z_import->worker->engine->resolver.trust_anchors;
knot_rrset_t *rr = kr_ta_get(trust_anchors, z_import->origin);
if (rr) {
z_import->ta = rr;
} else {
if (!rr) {
/* For now - fail.
* TODO - query DS and continue after answer had been obtained. */
KR_DNAME_GET_STR(zone_name_str, z_import->origin);
......
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