setup server debugging messages

This commit is contained in:
Willem Toorop 2016-06-28 15:06:02 +02:00
parent dc7bc4d116
commit ce415a6e2a
3 changed files with 12 additions and 12 deletions

View File

@ -143,14 +143,14 @@ ACX_ARG_RPATH
AC_ARG_ENABLE(debug-sched, AC_HELP_STRING([--enable-debug-sched], [Enable scheduling debugging messages]))
AC_ARG_ENABLE(debug-stub, AC_HELP_STRING([--enable-debug-stub], [Enable stub debugging messages]))
AC_ARG_ENABLE(debug-sec, AC_HELP_STRING([--enable-debug-sec], [Enable dnssec debugging messages]))
AC_ARG_ENABLE(debug-trace, AC_HELP_STRING([--enable-debug-trace], [Enable trace debugging of individual dns messages]))
AC_ARG_ENABLE(debug-server, AC_HELP_STRING([--enable-debug-server], [Enable server debugging messages]))
AC_ARG_ENABLE(all-debugging, AC_HELP_STRING([--enable-all-debugging], [Enable scheduling, stub and dnssec debugging]))
case "$enable_all_debugging" in
yes)
enable_debug_sched=yes
enable_debug_stub=yes
enable_debug_sec=yes
enable_debug_trace=yes
enable_debug_server=yes
;;
no|*)
;;
@ -176,9 +176,9 @@ case "$enable_debug_sec" in
no|*)
;;
esac
case "$enable_debug_trace" in
case "$enable_debug_server" in
yes)
AC_DEFINE_UNQUOTED([TRACE_DEBUG], [1], [Define this enable printing of transaction ids of individual dns messages.])
AC_DEFINE_UNQUOTED([SERVER_DEBUG], [1], [Define this enable printing of server debugging messages.])
;;
no|*)
;;

View File

@ -95,11 +95,11 @@
#define DEBUG_SEC(...) DEBUG_OFF(__VA_ARGS__)
#endif
#if defined(TRACE_DEBUG) && TRACE_DEBUG
#if defined(SERVER_DEBUG) && SERVER_DEBUG
#include <time.h>
#define DEBUG_TRACE(...) DEBUG_ON(__VA_ARGS__)
#define DEBUG_SERVER(...) DEBUG_ON(__VA_ARGS__)
#else
#define DEBUG_TRACE(...) DEBUG_OFF(__VA_ARGS__)
#define DEBUG_SERVER(...) DEBUG_OFF(__VA_ARGS__)
#endif
#endif

View File

@ -1110,10 +1110,10 @@ typedef struct dns_msg {
uint32_t cd_bit;
} dns_msg;
#if defined(TRACE_DEBUG) && TRACE_DEBUG
#if defined(SERVER_DEBUG) && SERVER_DEBUG
#define SERVFAIL(error,r,msg,resp_p) do { \
if (r) DEBUG_TRACE("%s: %s\n", error, getdns_get_errorstr_by_id(r)); \
else DEBUG_TRACE("%s\n", error); \
if (r) DEBUG_SERVER("%s: %s\n", error, getdns_get_errorstr_by_id(r)); \
else DEBUG_SERVER("%s\n", error); \
servfail(msg, resp_p); \
} while (0)
#else
@ -1150,7 +1150,7 @@ void request_cb(getdns_context *context, getdns_callback_type_t callback_type,
getdns_return_t r = GETDNS_RETURN_GOOD;
uint32_t n;
DEBUG_TRACE("reply for: %p %"PRIu64" %d\n", msg, transaction_id, (int)callback_type);
DEBUG_SERVER("reply for: %p %"PRIu64" %d\n", msg, transaction_id, (int)callback_type);
assert(msg);
#if 0
@ -1328,7 +1328,7 @@ void incoming_request_handler(getdns_context *context,
fprintf(stderr, "Could not schedule query: %s\n",
getdns_get_errorstr_by_id(r));
else {
DEBUG_TRACE("scheduled: %p %"PRIu64" for %s %d\n",
DEBUG_SERVER("scheduled: %p %"PRIu64" for %s %d\n",
msg, transaction_id, qname_str, (int)qtype);
free(qname_str);
return;