From: Evan Hunt Date: Fri, 18 Sep 2020 01:28:37 +0000 (-0700) Subject: report peer address in TLS mode, and specify protocol X-Git-Tag: v9.17.7~11^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8886569e9d11258f0c7f01bae1040435ffb61631;p=thirdparty%2Fbind9.git report peer address in TLS mode, and specify protocol - peer address was not being reported correctly by "dig +tls" - the protocol used is now reported in the dig output: UDP, TCP, or TLS. --- diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 708657d58fc..be48b2cc8c1 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -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); diff --git a/lib/isc/netmgr/tls.c b/lib/isc/netmgr/tls.c index df0a1a1a94e..d5049f1628e 100644 --- a/lib/isc/netmgr/tls.c +++ b/lib/isc/netmgr/tls.c @@ -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) {