]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add "delv +strace"
authorEvan Hunt <each@isc.org>
Thu, 2 Feb 2023 07:19:36 +0000 (23:19 -0800)
committerEvan Hunt <each@isc.org>
Tue, 28 Mar 2023 19:39:06 +0000 (12:39 -0700)
"delv +strace" is similar to "delv +mtrace", but sets the logging
level to DEBUG(11) instead of DEBUG(10), so that packets sent
will be logged along with packets received. "delv +ns" turns
this option on by default.

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

index ad747368d5131d830a594284e2bfdefc49545b2f..843690c4059686a15ec10c02e3ea3ada5c79498b 100644 (file)
@@ -129,7 +129,7 @@ static bool showcomments = true, showdnssec = true, showtrust = true,
            yaml = false, fulltrace = false;
 
 static bool resolve_trace = false, validator_trace = false,
-           message_trace = false;
+           message_trace = false, send_trace = false;
 
 static bool use_ipv4 = true, use_ipv6 = true;
 
@@ -228,6 +228,8 @@ usage(void) {
                "                 +[no]short          (Short form answer)\n"
                "                 +[no]split=##       (Split hex/base64 fields "
                "into chunks)\n"
+               "                 +[no]strace         (Trace messages "
+               "sent)\n"
                "                 +[no]tcp            (TCP mode)\n"
                "                 +[no]ttl            (Control display of ttls "
                "in records)\n"
@@ -307,6 +309,7 @@ setup_logging(FILE *errout) {
        isc_result_t result;
        isc_logdestination_t destination;
        isc_logconfig_t *logconfig = NULL;
+       int packetlevel = 10;
 
        isc_log_create(mctx, &lctx, &logconfig);
        isc_log_registercategories(lctx, categories);
@@ -359,9 +362,12 @@ setup_logging(FILE *errout) {
                }
        }
 
-       if (message_trace && loglevel < 10) {
+       if (send_trace) {
+               packetlevel = 11;
+       }
+       if ((message_trace || send_trace) && loglevel < packetlevel) {
                isc_log_createchannel(logconfig, "messages", ISC_LOG_TOFILEDESC,
-                                     ISC_LOG_DEBUG(10), &destination,
+                                     ISC_LOG_DEBUG(packetlevel), &destination,
                                      ISC_LOG_PRINTPREFIX);
 
                result = isc_log_usechannel(logconfig, "messages",
@@ -1165,6 +1171,7 @@ plus_option(char *option) {
        case 'm':
                switch (cmd[1]) {
                case 't': /* mtrace */
+                       FULLCHECK("mtrace");
                        message_trace = state;
                        if (state) {
                                resolve_trace = state;
@@ -1185,6 +1192,7 @@ plus_option(char *option) {
                        fulltrace = state;
                        if (state) {
                                message_trace = state;
+                               send_trace = state;
                                resolve_trace = state;
                                logfp = stdout;
                        }
@@ -1262,6 +1270,13 @@ plus_option(char *option) {
                                fatal("Couldn't parse split");
                        }
                        break;
+               case 't': /* strace */
+                       FULLCHECK("strace");
+                       send_trace = state;
+                       if (state) {
+                               message_trace = state;
+                       }
+                       break;
                default:
                        goto invalid_option;
                }
index 5d91fe75fb4a97fec862e56d089ee095ae5451b6..67c082e704cb9d36b304c4160801f2b62e28f8f6 100644 (file)
@@ -235,8 +235,8 @@ assign values to options like the timeout interval. They have the form
    This option toggles name server mode. When this option is in use,
    the ``delv`` process instantiates a full recursive resolver, and uses
    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
+   option also activates ``+mtrace``, ``+strace`` and ``+rtrace``, so that
+   every iterative query will be logged, including the full response messages
    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.
@@ -253,11 +253,11 @@ assign values to options like the timeout interval. They have the form
 
 .. option:: +rtrace, +nortrace
 
-   This option toggles resolver fetch logging. This reports the name and type of each
-   query sent by :program:`delv` in the process of carrying out the resolution
-   and validation process, including the original query
-   and all subsequent queries to follow CNAMEs and to establish a chain
-   of trust for DNSSEC validation.
+   This option toggles resolver fetch logging. This reports the name and
+   type of each query sent by :program:`delv` in the process of carrying
+   out the resolution and validation process, including the original query
+   and all subsequent queries to follow CNAMEs and to establish a chain of
+   trust for DNSSEC validation.
 
    This is equivalent to setting the debug level to 1 in the "resolver"
    logging category. Setting the systemwide debug level to 1 using the
@@ -266,15 +266,27 @@ assign values to options like the timeout interval. They have the form
 
 .. option:: +mtrace, +nomtrace
 
-   This option toggles message logging. This produces a detailed dump of the
-   responses received by :program:`delv` in the process of carrying out the
-   resolution and validation process.
+   This option toggles logging of messages received. This produces
+   a detailed dump of the responses received by :program:`delv` in the
+   process of carrying out the resolution and validation process.
 
    This is equivalent to setting the debug level to 10 for the "packets"
    module of the "resolver" logging category. Setting the systemwide
    debug level to 10 using the :option:`-d` option produces the same
    output, but affects other logging categories as well.
 
+.. option:: +strace, +nostrace
+
+   This option toggles logging of messages sent. This produces a detailed
+   dump of the queries sent by :program:`delv` in the process of carrying
+   out the resolution and validation process. Turning on this option 
+   also activates ``+mtrace``.
+
+   This is equivalent to setting the debug level to 11 for the "packets"
+   module of the "resolver" logging category. Setting the systemwide
+   debug level to 11 using the :option:`-d` option produces the same
+   output, but affects other logging categories as well.
+
 .. option:: +vtrace, +novtrace
 
    This option toggles validation logging. This shows the internal process of the