]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
mod-dnstap: option 'responses-with-queries' alised to 'query-with-resp'
authorJan Doskočil <jan.doskocil@nic.cz>
Fri, 5 Dec 2025 15:20:13 +0000 (16:20 +0100)
committerJan Doskočil <jan.doskocil@nic.cz>
Mon, 8 Dec 2025 11:44:50 +0000 (12:44 +0100)
Microsoft compatibility measure. Option logs deprecation warning.

src/knot/modules/dnstap/dnstap.c

index 3d4baa56106b50dfa369038eaad59dbfaa9ef1b8..204804fce6c51e7a568e3242deeb4dff44de7357 100644 (file)
@@ -19,6 +19,7 @@
 #define MOD_QUERIES            "\x0B""log-queries"
 #define MOD_RESPONSES          "\x0D""log-responses"
 #define MOD_WITH_QUERIES       "\x16""responses-with-queries"
+#define MOD_COMBINED           "\x0F""query-with-resp"
 
 const yp_item_t dnstap_conf[] = {
        { MOD_SINK,         YP_TSTR,  YP_VNONE },
@@ -27,6 +28,7 @@ const yp_item_t dnstap_conf[] = {
        { MOD_QUERIES,      YP_TBOOL, YP_VBOOL = { true } },
        { MOD_RESPONSES,    YP_TBOOL, YP_VBOOL = { true } },
        { MOD_WITH_QUERIES, YP_TBOOL, YP_VBOOL = { false } },
+       { MOD_COMBINED,     YP_TBOOL, YP_VBOOL = { false } }, // microsoft alias for responses-with-queries
        { NULL }
 };
 
@@ -38,6 +40,13 @@ int dnstap_conf_check(knotd_conf_check_args_t *args)
                return KNOT_EINVAL;
        }
 
+       knotd_conf_t resp_with_q = knotd_conf_check_item(args, MOD_WITH_QUERIES);
+       knotd_conf_t combined    = knotd_conf_check_item(args, MOD_COMBINED);
+       if (resp_with_q.count && combined.count) {
+               args->err_str = "'query-with-resp' is an alias for 'responses-with-queries'; cannot specify both";
+               return KNOT_EINVAL;
+       }
+
        return KNOT_EOK;
 }
 
@@ -300,14 +309,20 @@ int dnstap_load(knotd_mod_t *mod)
        }
        ctx->version_len = (ctx->version != NULL) ? strlen(ctx->version) : 0;
 
-       /* Set responses-with-queries. */
-       conf = knotd_conf_mod(mod, MOD_WITH_QUERIES);
-       ctx->with_queries = conf.single.boolean;
-
        /* Set sink. */
        conf = knotd_conf_mod(mod, MOD_SINK);
        const char *sink = conf.single.string;
 
+       /* Set responses-with-queries. */
+       conf = knotd_conf_mod(mod, MOD_WITH_QUERIES);
+       ctx->with_queries = conf.single.boolean;
+       conf = knotd_conf_mod(mod, MOD_COMBINED);
+       if (conf.count) {
+               knotd_mod_log(mod, LOG_WARNING,
+                       "'query-with-resp' is deprecated, use 'responses-with-queries' instead");
+               ctx->with_queries = conf.single.boolean;
+       }
+
        /* Set log_queries. */
        conf = knotd_conf_mod(mod, MOD_QUERIES);
        const bool log_queries = conf.single.boolean;