]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
report peer address in TLS mode, and specify protocol
authorEvan Hunt <each@isc.org>
Fri, 18 Sep 2020 01:28:37 +0000 (18:28 -0700)
committerOndřej Surý <ondrej@sury.org>
Tue, 10 Nov 2020 13:16:41 +0000 (14:16 +0100)
- peer address was not being reported correctly by "dig +tls"
- the protocol used is now reported in the dig output: UDP, TCP, or TLS.

bin/dig/dig.c
lib/isc/netmgr/tls.c

index 708657d58fc3c8b300e84aeef49622a187fdd7c2..be48b2cc8c1463240058a2099f516e7c185a56b4 100644 (file)
@@ -336,13 +336,22 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
        }
 
        if (query->lookup->stats) {
+               const char *proto;
                diff = isc_time_microdiff(&query->time_recv, &query->time_sent);
                if (query->lookup->use_usec) {
                        printf(";; Query time: %ld usec\n", (long)diff);
                } else {
                        printf(";; Query time: %ld msec\n", (long)diff / 1000);
                }
-               printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
+               if (query->lookup->tls_mode) {
+                       proto = "TLS";
+               } else if (query->lookup->tcp_mode) {
+                       proto = "TCP";
+               } else {
+                       proto = "UDP";
+               }
+               printf(";; SERVER: %s(%s) (%s)\n", fromtext, query->servname,
+                      proto);
                time(&tnow);
                (void)localtime_r(&tnow, &tmnow);
 
index df0a1a1a94e82161a0dc0c4e6b477a3ed3c3d268..d5049f1628e0fc0c784d0be9cd4bf57a564267f8 100644 (file)
@@ -653,6 +653,7 @@ tls_connect_cb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
 
        INSIST(VALID_NMHANDLE(handle));
 
+       tlssock->peer = isc_nmhandle_peeraddr(handle);
        isc_nmhandle_attach(handle, &tlssock->outerhandle);
        result = initialize_tls(tlssock, false);
        if (result != ISC_R_SUCCESS) {