add "delv +qmin"

add an option to enable or disable QNAME minimization in delv's
internal resolver.
This commit is contained in:
Evan Hunt 2023-03-03 00:46:36 -08:00
parent 152d25668e
commit c277df8c1f
2 changed files with 36 additions and 0 deletions

View 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));

View 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