From 97a4f20bc75424418b3e8125a7b72f482d9fae2e Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 27 Apr 2015 09:58:23 -0400 Subject: rpcbind: enable debugging in libtirpc Recently a libtirpc_set_debug() command was added to libtirpc that enables debugging in the library. Now when debug is enabled with rpcbind, this new library debugging will be enabled as well, when the interface exists. Signed-off-by: Steve Dickson --- Makefile.am | 4 ++++ configure.ac | 4 ++++ src/rpcbind.c | 12 +++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3add1e3..5ec8cd6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,10 @@ AM_CPPFLAGS += -DRPCBIND_DEBUG -DDEBUG_RMTCALL AM_CPPFLAGS += -DND_DEBUG -DBIND_DEBUG endif +if LIBSETDEBUG +AM_CPPFLAGS += -DLIB_SET_DEBUG +endif + if WARMSTART AM_CPPFLAGS += -DWARMSTART endif diff --git a/configure.ac b/configure.ac index 39cd129..90e1db5 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,10 @@ AM_CONDITIONAL(LIBWRAP, test x$enable_libwrap = xyes) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Turns on rpcbind debugging @<:@default=no@:>@])) AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes) +if test x"$enable_debug" = xyes; then + AC_CHECK_LIB([tirpc], [libtirpc_set_debug], [lib_setdebug=yes]) +fi +AM_CONDITIONAL(LIBSETDEBUG, test x$lib_setdebug = xyes) AC_ARG_ENABLE([warmstarts], AS_HELP_STRING([--enable-warmstarts], [Enables Warm Starts @<:@default=no@:>@])) diff --git a/src/rpcbind.c b/src/rpcbind.c index 6d8bed2..045daa1 100644 --- a/src/rpcbind.c +++ b/src/rpcbind.c @@ -117,6 +117,9 @@ int nhosts = 0; int on = 1; int rpcbindlockfd; +#ifdef LIB_SET_DEBUG +void libtirpc_set_debug(char *name, int level, int use_stderr); +#endif #ifdef WARMSTART /* Local Variable */ static int warmstart = 0; /* Grab an old copy of registrations. */ @@ -199,9 +202,12 @@ main(int argc, char *argv[]) xlog_syslog(FALSE); xlog_stderr(TRUE); } - if (debugging) + if (debugging) { xlog_config(D_ALL, 1); - +#ifdef LIB_SET_DEBUG + libtirpc_set_debug("rpcbind", debugging, (dofork == 0)); +#endif + } rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); init_transport(nconf); @@ -870,7 +876,7 @@ parseargs(int argc, char *argv[]) break; /* errors; for rpcbind developers */ /* only! */ case 'd': - debugging = 1; + debugging++; break; case 'h': ++nhosts; -- cgit v1.2.1