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

Commit 15fd74f

Browse files
committed
add "delv +hint"
Add the ablity to specify a hints file from which to load root name server addresses, so that "delv +ns" can be used with test name servers.
1 parent c277df8 commit 15fd74f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

bin/delv/delv.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static char *curqname = NULL, *qname = NULL;
120120
static bool classset = false;
121121
static dns_rdatatype_t qtype = dns_rdatatype_none;
122122
static bool typeset = false;
123+
static const char *hintfile = NULL;
123124

124125
static unsigned int styleflags = 0;
125126
static uint32_t splitwidth = 0xffffffff;
@@ -1171,6 +1172,22 @@ plus_option(char *option) {
11711172
goto invalid_option;
11721173
}
11731174
break;
1175+
case 'h':
1176+
switch (cmd[1]) {
1177+
case 'i': /* hint */
1178+
if (state) {
1179+
if (value == NULL) {
1180+
fatal("+hint: must specify hint file");
1181+
}
1182+
hintfile = value;
1183+
} else {
1184+
hintfile = NULL;
1185+
}
1186+
break;
1187+
default:
1188+
goto invalid_option;
1189+
}
1190+
break;
11741191
case 'm':
11751192
switch (cmd[1]) {
11761193
case 't': /* mtrace */
@@ -2121,7 +2138,7 @@ run_server(void *arg) {
21212138
dns_cache_detach(&cache);
21222139
dns_view_setdstport(view, destport);
21232140

2124-
CHECK(dns_rootns_create(mctx, dns_rdataclass_in, NULL, &roothints));
2141+
CHECK(dns_rootns_create(mctx, dns_rdataclass_in, hintfile, &roothints));
21252142
dns_view_sethints(view, roothints);
21262143
dns_db_detach(&roothints);
21272144

@@ -2156,6 +2173,9 @@ run_server(void *arg) {
21562173
return;
21572174

21582175
cleanup:
2176+
if (view != NULL) {
2177+
dns_view_detach(&view);
2178+
}
21592179
shutdown_server();
21602180
}
21612181

@@ -2186,6 +2206,12 @@ main(int argc, char *argv[]) {
21862206

21872207
setup_logging(logfp);
21882208

2209+
if (!fulltrace && hintfile != NULL) {
2210+
delv_log(ISC_LOG_WARNING,
2211+
"WARNING: not using internal name server mode, "
2212+
"hint file will be ignored");
2213+
}
2214+
21892215
if (fulltrace && server != NULL) {
21902216
delv_log(ISC_LOG_WARNING,
21912217
"WARNING: using internal name server mode: "

bin/delv/delv.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ assign values to options like the timeout interval. They have the form
230230
This option controls whether to display the CLASS when printing a record. The
231231
default is to display the CLASS.
232232

233+
.. option:: +hint=FILE, +nohint
234+
235+
This option specifies a filename from which to load root hints;
236+
this will be used to find the root name servers when name server
237+
mode (``delv +ns``) is in use. If the option is not specified,
238+
built-in root hints will be used.
239+
233240
.. option:: +ns, +nons
234241

235242
This option toggles name server mode. When this option is in use,

0 commit comments

Comments
 (0)