]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
report client transport in 'rndc recursing'
authorEvan Hunt <each@isc.org>
Fri, 4 Oct 2024 02:51:20 +0000 (19:51 -0700)
committerEvan Hunt <each@isc.org>
Mon, 14 Oct 2024 19:59:52 +0000 (12:59 -0700)
when dumping the list of recursing clients, indicate whether
a given query was sent over UDP, TCP, TLS, or HTTP.

bin/rndc/rndc.rst
lib/dns/include/dns/transport.h
lib/dns/transport.c
lib/ns/client.c

index b59f62e6722e41387067ae14030cf1e8e9e2eb54..0559ed7339cd4805549323aa8754bd69d75184d8 100644 (file)
@@ -429,8 +429,10 @@ Currently supported commands are:
 
    The first list includes all unique clients that are waiting for
    recursion to complete, including the query that is awaiting a
-   response and the timestamp (seconds since the Unix epoch) of
-   when named started processing this client query.
+   response, the timestamp (seconds since the Unix epoch) of
+   when named started processing this client query, the client's
+   address, and the transport over which the the query was received
+   (UDP, TCP, TLS, or HTTP).
 
    The second list comprises of domains for which there are active
    (or recently active) fetches in progress.  It reports the number
index b8845208e360697ef44fda46c6db0ecaf408f617..15892e46d830c682ff58389520db1f647d94431d 100644 (file)
@@ -204,3 +204,9 @@ dns_transport_list_detach(dns_transport_list_t **listp);
  *\li  'listp' is not NULL.
  *\li  '*listp' is a valid transport list.
  */
+
+const char *
+dns_transport_totext(dns_transport_type_t type);
+/*%<
+ * Convert a transport type value into a string.
+ */
index b2328d144c4ebb10d47dcf7d811f0877d2f85b3d..52bb6bce39fb21bcb42a9b3bd573f86e30ef3642 100644 (file)
@@ -772,3 +772,19 @@ dns_transport_list_detach(dns_transport_list_t **listp) {
                transport_list_destroy(list);
        }
 }
+
+const char *
+dns_transport_totext(dns_transport_type_t type) {
+       switch (type) {
+       case DNS_TRANSPORT_UDP:
+               return ("udp");
+       case DNS_TRANSPORT_TCP:
+               return ("tcp");
+       case DNS_TRANSPORT_TLS:
+               return ("tls");
+       case DNS_TRANSPORT_HTTP:
+               return ("https");
+       default:
+               UNREACHABLE();
+       }
+}
index cc76632f0b31727347755f33a02ee9a909b70032..76293eda453e0ff9ba6c90d8d2e383c5f9160a36 100644 (file)
@@ -141,7 +141,6 @@ static void
 compute_cookie(ns_client_t *client, uint32_t when, const unsigned char *secret,
               isc_buffer_t *buf);
 
-#ifdef HAVE_DNSTAP
 static dns_transport_type_t
 ns_client_transport_type(const ns_client_t *client) {
        /*
@@ -186,7 +185,6 @@ ns_client_transport_type(const ns_client_t *client) {
 
        return DNS_TRANSPORT_UDP;
 }
-#endif /* HAVE_DNSTAP */
 
 void
 ns_client_recursing(ns_client_t *client) {
@@ -2921,10 +2919,12 @@ ns_client_dumprecursing(FILE *f, ns_clientmgr_t *manager) {
                }
                UNLOCK(&client->query.fetchlock);
                fprintf(f,
-                       "; client %s%s%s: id %u '%s/%s/%s'%s%s "
+                       "; client %s (%s)%s%s: id %u '%s/%s/%s'%s%s "
                        "requesttime %u\n",
-                       peerbuf, sep, name, client->message->id, namebuf,
-                       typebuf, classbuf, origfor, original,
+                       peerbuf,
+                       dns_transport_totext(ns_client_transport_type(client)),
+                       sep, name, client->message->id, namebuf, typebuf,
+                       classbuf, origfor, original,
                        isc_time_seconds(&client->requesttime));
                client = ISC_LIST_NEXT(client, rlink);
        }