]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
worker_resolve: truly honor the options parameter
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 15 Mar 2017 15:37:36 +0000 (16:37 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 15 Mar 2017 17:20:30 +0000 (18:20 +0100)
It was being overwritten by options from struct kr_context;
now the flags are combined (by set union).

For example, the NO_CACHE flag is important for the prefetch module and
for trust anchor updates.

daemon/worker.c
daemon/worker.h

index 21efd306baa7effd3af46ed1c68d3e0bc0ff1cc9..b31c7a18c6a12b35b2d6a3f1a21f141b1f9a5a5c 100644 (file)
@@ -1049,9 +1049,12 @@ int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned option
        }
        task->baton = baton;
        task->on_complete = on_complete;
-       task->req.options |= options;
        /* Start task */
        int ret = qr_task_start(task, query);
+
+       /* Set options late, as qr_task_start() -> kr_resolve_begin() rewrite it. */
+       task->req.options |= options;
+
        if (ret != 0) {
                qr_task_unref(task);
                return ret;
index 4219f4a1ead9eff9d8ff759f7050c079266efa4c..c99a429d4dd548aec5f0f5323a79d30e84b2131f 100644 (file)
@@ -54,7 +54,11 @@ int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle);
 
 /**
  * Schedule query for resolution.
+ *
  * @return 0 or an error code
+ *
+ * @note the options passed are |-combined with struct kr_context::options
+ * @todo maybe better semantics for this?
  */
 int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options,
                worker_cb_t on_complete, void *baton);