]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add "delv +qmin"
authorEvan Hunt <each@isc.org>
Fri, 3 Mar 2023 08:46:36 +0000 (00:46 -0800)
committerEvan Hunt <each@isc.org>
Tue, 28 Mar 2023 19:39:06 +0000 (12:39 -0700)
add an option to enable or disable QNAME minimization in delv's
internal resolver.

bin/delv/delv.c
bin/delv/delv.rst

index 843690c4059686a15ec10c02e3ea3ada5c79498b..eba5483c92157ab5e7fd5a774439a0bd0f176d6f 100644 (file)
@@ -134,6 +134,7 @@ static bool resolve_trace = false, validator_trace = false,
 static bool use_ipv4 = true, use_ipv6 = true;
 
 static bool cdflag = false, no_sigs = false, root_validation = true;
+static bool qmin = false, qmin_strict = false;
 
 static bool use_tcp = false;
 
@@ -218,6 +219,8 @@ usage(void) {
                "server)\n"
                "                 +[no]multiline      (Print records in an "
                "expanded format)\n"
+               "                 +[no]qmin[=mode]    (QNAME minimization: "
+               "relaxed or strict)\n"
                "                 +[no]root           (DNSSEC validation trust "
                "anchor)\n"
                "                 +[no]rrcomments     (Control display of "
@@ -1201,6 +1204,25 @@ plus_option(char *option) {
                        goto invalid_option;
                }
                break;
+       case 'q': /* qmin */
+               FULLCHECK("qmin");
+               if (state) {
+                       if (value == NULL || strcasecmp(value, "relaxed") == 0)
+                       {
+                               qmin = true;
+                       } else if (strcasecmp(value, "strict") == 0) {
+                               qmin = true;
+                               qmin_strict = true;
+                       } else {
+                               fatal("Invalid qmin option '%s': "
+                                     "use 'relaxed' or 'strict'\n",
+                                     value);
+                       }
+               } else {
+                       qmin = false;
+                       qmin_strict = false;
+               }
+               break;
        case 'r':
                switch (cmd[1]) {
                case 'o': /* root */
@@ -1337,6 +1359,10 @@ plus_option(char *option) {
                fprintf(stderr, "Invalid option: +%s\n", option);
                usage();
        }
+
+       if (qmin && !fulltrace) {
+               fatal("'+qmin' cannot be used without '+ns'");
+       }
        return;
 }
 
@@ -2099,6 +2125,9 @@ run_server(void *arg) {
        dns_view_sethints(view, roothints);
        dns_db_detach(&roothints);
 
+       view->qminimization = qmin;
+       view->qmin_strict = qmin_strict;
+
        CHECK(dns_view_initsecroots(view, mctx));
        CHECK(setup_dnsseckeys(NULL, view));
 
index 67c082e704cb9d36b304c4160801f2b62e28f8f6..6cad0c0af160ac1480e8f71a5c777d99b366a6c6 100644 (file)
@@ -246,6 +246,13 @@ assign values to options like the timeout interval. They have the form
    replicates the behavior of a recursive name server with a cold cache
    that is processing a recursive query.
 
+.. option:: +qmin[=MODE], +noqmin
+
+   When used with ``+ns``, this option enables QNAME minimization mode.
+   Valid options of MODE are ``relaxed`` and ``strict``. By default,
+   QNAME minimization is disabled.  If ``+qmin`` is specified but MODE
+   is omitted, then ``relaxed`` mode will be used.
+
 .. option:: +ttl, +nottl
 
    This option controls whether to display the TTL when printing a record. The