Commit 1783676a authored by Mukund Sivaraman's avatar Mukund Sivaraman

Add a --enable-querytrace configure switch for very verbose query tracelogging (#37520)

parent ebeb668f
4072. [func] Add a --enable-querytrace configure switch for
very verbose query tracelogging. [RT #37520]
4071. [cleanup] Initialize pthread mutex attrs just once, instead of 4071. [cleanup] Initialize pthread mutex attrs just once, instead of
doing it per mutex creation. [RT #38547] doing it per mutex creation. [RT #38547]
......
...@@ -126,24 +126,30 @@ ...@@ -126,24 +126,30 @@
#define NOQNAME(r) (((r)->attributes & \ #define NOQNAME(r) (((r)->attributes & \
DNS_RDATASETATTR_NOQNAME) != 0) DNS_RDATASETATTR_NOQNAME) != 0)
#if 0 #ifdef WANT_QUERYTRACE
#define CTRACE(l,m) do { \ #define CTRACE(l,m) do { \
if (client != NULL && client->query.qname != NULL) { \ if (client != NULL && client->query.qname != NULL) { \
char qbuf[DNS_NAME_FORMATSIZE]; \ if (isc_log_wouldlog(ns_g_lctx, l)) { \
dns_name_format(client->query.qname, qbuf, sizeof(qbuf)); \ char qbuf[DNS_NAME_FORMATSIZE]; \
isc_log_write(ns_g_lctx, \ dns_name_format(client->query.qname, \
NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY, \ qbuf, sizeof(qbuf)); \
l, "client %p (%s): %s", client, qbuf, (m)); \ isc_log_write(ns_g_lctx, \
} else { \ NS_LOGCATEGORY_CLIENT, \
isc_log_write(ns_g_lctx, \ NS_LOGMODULE_QUERY, \
NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY, \ l, "client %p (%s): %s", \
l, "client %p (<unknown-name>): %s", \ client, qbuf, (m)); \
client, (m)); \ } \
} \ } else { \
isc_log_write(ns_g_lctx, \
NS_LOGCATEGORY_CLIENT, \
NS_LOGMODULE_QUERY, \
l, "client %p (<unknown-name>): %s", \
client, (m)); \
} \
} while(0) } while(0)
#else #else
#define CTRACE(l,m) ((void)m) #define CTRACE(l,m) ((void)m)
#endif #endif /* WANT_QUERYTRACE */
#define DNS_GETDB_NOEXACT 0x01U #define DNS_GETDB_NOEXACT 0x01U
......
...@@ -528,6 +528,9 @@ int sigwait(const unsigned int *set, int *sig); ...@@ -528,6 +528,9 @@ int sigwait(const unsigned int *set, int *sig);
non-blocking. */ non-blocking. */
#undef USE_FIONBIO_IOCTL #undef USE_FIONBIO_IOCTL
/* Define to enable very verbose query trace logging. */
#undef WANT_QUERYTRACE
/* define if idnkit support is to be included. */ /* define if idnkit support is to be included. */
#undef WITH_IDN #undef WITH_IDN
......
...@@ -1027,6 +1027,7 @@ with_iconv ...@@ -1027,6 +1027,7 @@ with_iconv
with_idnlib with_idnlib
with_atf with_atf
with_tuning with_tuning
enable_querytrace
with_dlopen with_dlopen
with_dlz_postgres with_dlz_postgres
with_dlz_mysql with_dlz_mysql
...@@ -1698,6 +1699,7 @@ Optional Features: ...@@ -1698,6 +1699,7 @@ Optional Features:
--disable-rpz-nsip disable rpz-nsip rules [default=enabled] --disable-rpz-nsip disable rpz-nsip rules [default=enabled]
--disable-rpz-nsdname disable rpz-nsdname rules [default=enabled] --disable-rpz-nsdname disable rpz-nsdname rules [default=enabled]
--enable-filter-aaaa enable filtering of AAAA records [default=no] --enable-filter-aaaa enable filtering of AAAA records [default=no]
--enable-querytrace enable very verbose query trace logging [default=no]
--enable-full-report report values of all configure options --enable-full-report report values of all configure options
Optional Packages: Optional Packages:
...@@ -20597,6 +20599,34 @@ $as_echo "using default tuning" >&6; } ...@@ -20597,6 +20599,34 @@ $as_echo "using default tuning" >&6; }
;; ;;
esac esac
#
# was --enable-querytrace specified?
#
# Check whether --enable-querytrace was given.
if test "${enable_querytrace+set}" = set; then :
enableval=$enable_querytrace; want_querytrace="$enableval"
else
want_querytrace="no"
fi
case "$want_querytrace" in
yes)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define WANT_QUERYTRACE 1" >>confdefs.h
;;
no)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
*)
as_fn_error $? "\"--enable-querytrace requires yes or no\"" "$LINENO" 5
;;
esac
# #
# Substitutions # Substitutions
# #
...@@ -24342,6 +24372,8 @@ test "$want_symtable" = "minimal" && \ ...@@ -24342,6 +24372,8 @@ test "$want_symtable" = "minimal" && \
test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \ test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \
echo " Use symbol table for backtrace, all binaries (--enable-symtable=all)" echo " Use symbol table for backtrace, all binaries (--enable-symtable=all)"
test "$use_libtool" = "no" || echo " Use GNU libtool (--with-libtool)" test "$use_libtool" = "no" || echo " Use GNU libtool (--with-libtool)"
test "$want_querytrace" = "yes" && \
echo " Very verbose query trace logging (--enable-querytrace)"
test "$atf" = "no" || echo " Automated Testing Framework (--with-atf)" test "$atf" = "no" || echo " Automated Testing Framework (--with-atf)"
echo " Dynamically loadable zone (DLZ) drivers:" echo " Dynamically loadable zone (DLZ) drivers:"
...@@ -24392,6 +24424,9 @@ test "$enable_seccomp" = yes || \ ...@@ -24392,6 +24424,9 @@ test "$enable_seccomp" = yes || \
echo " Use libseccomp system call filtering (--enable-seccomp)" echo " Use libseccomp system call filtering (--enable-seccomp)"
test "$want_backtrace" = "yes" || \ test "$want_backtrace" = "yes" || \
echo " Print backtrace on crash (--enable-backtrace)" echo " Print backtrace on crash (--enable-backtrace)"
test "$want_querytrace" = "yes" || \
echo " Very verbose query trace logging (--enable-querytrace)"
test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)" test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)"
test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)" test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)"
......
...@@ -4142,6 +4142,26 @@ case "$use_tuning" in ...@@ -4142,6 +4142,26 @@ case "$use_tuning" in
;; ;;
esac esac
#
# was --enable-querytrace specified?
#
AC_ARG_ENABLE(querytrace,
[ --enable-querytrace enable very verbose query trace logging [[default=no]]],
want_querytrace="$enableval", want_querytrace="no")
case "$want_querytrace" in
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(WANT_QUERYTRACE, 1, [Define to enable very verbose query trace logging.])
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_ERROR("--enable-querytrace requires yes or no")
;;
esac
# #
# Substitutions # Substitutions
# #
...@@ -4752,6 +4772,8 @@ test "$want_symtable" = "minimal" && \ ...@@ -4752,6 +4772,8 @@ test "$want_symtable" = "minimal" && \
test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \ test "$want_symtable" = "yes" -o "$want_symtable" = "all" && \
echo " Use symbol table for backtrace, all binaries (--enable-symtable=all)" echo " Use symbol table for backtrace, all binaries (--enable-symtable=all)"
test "$use_libtool" = "no" || echo " Use GNU libtool (--with-libtool)" test "$use_libtool" = "no" || echo " Use GNU libtool (--with-libtool)"
test "$want_querytrace" = "yes" && \
echo " Very verbose query trace logging (--enable-querytrace)"
test "$atf" = "no" || echo " Automated Testing Framework (--with-atf)" test "$atf" = "no" || echo " Automated Testing Framework (--with-atf)"
echo " Dynamically loadable zone (DLZ) drivers:" echo " Dynamically loadable zone (DLZ) drivers:"
...@@ -4802,6 +4824,9 @@ test "$enable_seccomp" = yes || \ ...@@ -4802,6 +4824,9 @@ test "$enable_seccomp" = yes || \
echo " Use libseccomp system call filtering (--enable-seccomp)" echo " Use libseccomp system call filtering (--enable-seccomp)"
test "$want_backtrace" = "yes" || \ test "$want_backtrace" = "yes" || \
echo " Print backtrace on crash (--enable-backtrace)" echo " Print backtrace on crash (--enable-backtrace)"
test "$want_querytrace" = "yes" || \
echo " Very verbose query trace logging (--enable-querytrace)"
test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)" test "$use_libtool" = "yes" || echo " Use GNU libtool (--with-libtool)"
test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)" test "$atf" = "no" && echo " Automated Testing Framework (--with-atf)"
......
...@@ -71,8 +71,7 @@ ...@@ -71,8 +71,7 @@
#include <dns/tsig.h> #include <dns/tsig.h>
#include <dns/validator.h> #include <dns/validator.h>
#define DNS_RESOLVER_TRACE #ifdef WANT_QUERYTRACE
#ifdef DNS_RESOLVER_TRACE
#define RTRACE(m) isc_log_write(dns_lctx, \ #define RTRACE(m) isc_log_write(dns_lctx, \
DNS_LOGCATEGORY_RESOLVER, \ DNS_LOGCATEGORY_RESOLVER, \
DNS_LOGMODULE_RESOLVER, \ DNS_LOGMODULE_RESOLVER, \
...@@ -128,13 +127,16 @@ ...@@ -128,13 +127,16 @@
query, query->fctx, \ query, query->fctx, \
query->fctx->info, (m)) query->fctx->info, (m))
#else #else
#define RTRACE(m) #define RTRACE(m) do { UNUSED(m); } while (0)
#define RRTRACE(r, m) #define RRTRACE(r, m) do { UNUSED(r); UNUSED(m); } while (0)
#define FCTXTRACE(m) #define FCTXTRACE(m) do { UNUSED(m); } while (0)
#define FCTXTRACE2(m1, m2) #define FCTXTRACE2(m1, m2) do { UNUSED(m1); UNUSED(m2); } while (0)
#define FTRACE(m) #define FCTXTRACE3(m1, res) do { UNUSED(m1); UNUSED(res); } while (0)
#define QTRACE(m) #define FCTXTRACE4(m1, m2, res) \
#endif do { UNUSED(m1); UNUSED(m2); UNUSED(res); } while (0)
#define FTRACE(m) do { UNUSED(m); } while (0)
#define QTRACE(m) do { UNUSED(m); } while (0)
#endif /* WANT_QUERYTRACE */
#define US_PER_SEC 1000000U #define US_PER_SEC 1000000U
/* /*
...@@ -3241,6 +3243,9 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) { ...@@ -3241,6 +3243,9 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) {
bogus) bogus)
aborted = ISC_TRUE; aborted = ISC_TRUE;
if (!isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(3)))
return;
if (aborted) { if (aborted) {
addr->flags |= FCTX_ADDRINFO_MARK; addr->flags |= FCTX_ADDRINFO_MARK;
msg = "ignoring blackholed / bogus server: "; msg = "ignoring blackholed / bogus server: ";
...@@ -3261,9 +3266,6 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) { ...@@ -3261,9 +3266,6 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) {
} else } else
return; return;
if (!isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(3)))
return;
isc_netaddr_fromsockaddr(&na, sa); isc_netaddr_fromsockaddr(&na, sa);
isc_netaddr_format(&na, buf, sizeof(buf)); isc_netaddr_format(&na, buf, sizeof(buf));
FCTXTRACE2(msg, buf); FCTXTRACE2(msg, buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment