#define MAXNAME (DNS_NAME_MAXTEXT + 1)
/* Variables used internally by delv. */
-char *progname;
+char *progname = NULL;
static isc_mem_t *mctx = NULL;
static isc_log_t *lctx = NULL;
static dns_view_t *view = NULL;
static dns_db_t *roothints = NULL;
static isc_stats_t *resstats = NULL;
static dns_stats_t *resquerystats = NULL;
+static FILE *logfp = NULL;
/* Managers */
static isc_nm_t *netmgr = NULL;
if (state) {
message_trace = state;
resolve_trace = state;
+ logfp = stdout;
}
break;
default:
dns_request_t *request = (dns_request_t *)arg;
dns_message_t *query = dns_request_getarg(request);
isc_result_t result = dns_request_getresult(request);
- ;
dns_message_t *response = NULL;
if (result != ISC_R_SUCCESS) {
dns_message_detach(&response);
dns_request_destroy(&request);
- view = NULL;
+ dns_view_detach(&view);
shutdown_server();
}
CHECK(dns_requestmgr_create(mctx, dispatchmgr, NULL, NULL,
&requestmgr));
+ dns_view_attach(view, &(dns_view_t *){ NULL });
CHECK(dns_request_create(requestmgr, message, NULL, &peer, NULL, NULL,
DNS_REQUESTOPT_TCP, NULL, 1, 0, 0,
isc_loop_current(loopmgr), recvresponse,
isc_loop_t *loop = NULL;
progname = argv[0];
+ logfp = stderr;
+
preparse_args(argc, argv);
argc--;
CHECK(setup_style());
- setup_logging(stderr);
+ setup_logging(logfp);
if (fulltrace && server != NULL) {
delv_log(ISC_LOG_WARNING,
that to look up the requested query name and type. Turning on this
option also activates ``+mtrace`` and ``+rtrace``, so that every
iterative query will be logged, including the full response messages
- from each authoritatve server.
+ from each authoritatve server. These logged messages will be written
+ to ``stdout`` rather than ``stderr`` as usual, so that the full trace
+ can be captured more easily.
This is intended to be similar to the behavior of ``dig +trace``, but
because it uses the same code as ``named``, it much more accurately
replicates the behavior of a recursive name server with a cold cache
- processing a recursive query.
+ that is processing a recursive query.
.. option:: +ttl, +nottl