Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit c277df8

Browse files
committed
add "delv +qmin"
add an option to enable or disable QNAME minimization in delv's internal resolver.
1 parent 152d256 commit c277df8

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

bin/delv/delv.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static bool resolve_trace = false, validator_trace = false,
134134
static bool use_ipv4 = true, use_ipv6 = true;
135135

136136
static bool cdflag = false, no_sigs = false, root_validation = true;
137+
static bool qmin = false, qmin_strict = false;
137138

138139
static bool use_tcp = false;
139140

@@ -218,6 +219,8 @@ usage(void) {
218219
"server)\n"
219220
" +[no]multiline (Print records in an "
220221
"expanded format)\n"
222+
" +[no]qmin[=mode] (QNAME minimization: "
223+
"relaxed or strict)\n"
221224
" +[no]root (DNSSEC validation trust "
222225
"anchor)\n"
223226
" +[no]rrcomments (Control display of "
@@ -1201,6 +1204,25 @@ plus_option(char *option) {
12011204
goto invalid_option;
12021205
}
12031206
break;
1207+
case 'q': /* qmin */
1208+
FULLCHECK("qmin");
1209+
if (state) {
1210+
if (value == NULL || strcasecmp(value, "relaxed") == 0)
1211+
{
1212+
qmin = true;
1213+
} else if (strcasecmp(value, "strict") == 0) {
1214+
qmin = true;
1215+
qmin_strict = true;
1216+
} else {
1217+
fatal("Invalid qmin option '%s': "
1218+
"use 'relaxed' or 'strict'\n",
1219+
value);
1220+
}
1221+
} else {
1222+
qmin = false;
1223+
qmin_strict = false;
1224+
}
1225+
break;
12041226
case 'r':
12051227
switch (cmd[1]) {
12061228
case 'o': /* root */
@@ -1337,6 +1359,10 @@ plus_option(char *option) {
13371359
fprintf(stderr, "Invalid option: +%s\n", option);
13381360
usage();
13391361
}
1362+
1363+
if (qmin && !fulltrace) {
1364+
fatal("'+qmin' cannot be used without '+ns'");
1365+
}
13401366
return;
13411367
}
13421368

@@ -2099,6 +2125,9 @@ run_server(void *arg) {
20992125
dns_view_sethints(view, roothints);
21002126
dns_db_detach(&roothints);
21012127

2128+
view->qminimization = qmin;
2129+
view->qmin_strict = qmin_strict;
2130+
21022131
CHECK(dns_view_initsecroots(view, mctx));
21032132
CHECK(setup_dnsseckeys(NULL, view));
21042133

bin/delv/delv.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ assign values to options like the timeout interval. They have the form
246246
replicates the behavior of a recursive name server with a cold cache
247247
that is processing a recursive query.
248248

249+
.. option:: +qmin[=MODE], +noqmin
250+
251+
When used with ``+ns``, this option enables QNAME minimization mode.
252+
Valid options of MODE are ``relaxed`` and ``strict``. By default,
253+
QNAME minimization is disabled. If ``+qmin`` is specified but MODE
254+
is omitted, then ``relaxed`` mode will be used.
255+
249256
.. option:: +ttl, +nottl
250257

251258
This option controls whether to display the TTL when printing a record. The

0 commit comments

Comments
 (0)