svn commit: r332937 - in user/markj/netdump/sys: conf netinet/netdump

Mark Johnston markj at FreeBSD.org
Tue Apr 24 14:52:19 UTC 2018


Author: markj
Date: Tue Apr 24 14:52:17 2018
New Revision: 332937
URL: https://svnweb.freebsd.org/changeset/base/332937

Log:
  Enable NETDUMP_DEBUG's with a tunable rather than a compile option.

Modified:
  user/markj/netdump/sys/conf/NOTES
  user/markj/netdump/sys/conf/options
  user/markj/netdump/sys/netinet/netdump/netdump_client.c

Modified: user/markj/netdump/sys/conf/NOTES
==============================================================================
--- user/markj/netdump/sys/conf/NOTES	Tue Apr 24 14:49:09 2018	(r332936)
+++ user/markj/netdump/sys/conf/NOTES	Tue Apr 24 14:52:17 2018	(r332937)
@@ -1025,8 +1025,9 @@ options 	TCP_SIGNATURE		#include support for RFC 2385
 # a smooth scheduling of the traffic.
 options 	DUMMYNET
 
+# The NETDUMP option enables netdump(4) client support in the kernel.
+# This allows a panicking kernel to transmit a kernel dump to a remote host.
 options 	NETDUMP
-options 	NETDUMP_DEBUG
 
 #####################################################################
 # FILESYSTEM OPTIONS

Modified: user/markj/netdump/sys/conf/options
==============================================================================
--- user/markj/netdump/sys/conf/options	Tue Apr 24 14:49:09 2018	(r332936)
+++ user/markj/netdump/sys/conf/options	Tue Apr 24 14:52:17 2018	(r332937)
@@ -312,8 +312,8 @@ NFS_ROOT	opt_nfsroot.h
 # SMB/CIFS requester
 NETSMB		opt_netsmb.h
 
+# Enable netdump(4) client support.
 NETDUMP 	opt_global.h
-NETDUMP_DEBUG 	opt_netdump.h
 
 # Options used only in subr_param.c.
 HZ		opt_param.h

Modified: user/markj/netdump/sys/netinet/netdump/netdump_client.c
==============================================================================
--- user/markj/netdump/sys/netinet/netdump/netdump_client.c	Tue Apr 24 14:49:09 2018	(r332936)
+++ user/markj/netdump/sys/netinet/netdump/netdump_client.c	Tue Apr 24 14:52:17 2018	(r332937)
@@ -71,26 +71,22 @@ __FBSDID("$FreeBSD$");
 #include <machine/in_cksum.h>
 #include <machine/pcb.h>
 
-#ifdef NETDUMP_DEBUG
-#define	NETDDEBUG(f, ...)					\
-	printf(("%s: " f), __func__, ## __VA_ARGS__)
-#define	NETDDEBUG_IF(i, f, ...)					\
-	if_printf((i), ("%s: " f), __func__, ## __VA_ARGS__)
-#if NETDUMP_DEBUG > 1
-#define	NETDDEBUGV(f, ...)					\
-	printf(("%s: " f), __func__, ## __VA_ARGS__)
-#define	NETDDEBUGV_IF(i, f, ...)				\
-	if_printf((i), ("%s: " f), __func__, ## __VA_ARGS__)
-#else
-#define	NETDDEBUGV(f, ...)
-#define	NETDDEBUGV_IF(i, f, ...)
-#endif
-#else
-#define	NETDDEBUG(f, ...)
-#define	NETDDEBUG_IF(i, f, ...)
-#define	NETDDEBUGV(f, ...)
-#define	NETDDEBUGV_IF(i, f, ...)
-#endif
+#define	NETDDEBUG(f, ...) do {						\
+	if (nd_debug > 0)						\
+		printf(("%s: " f), __func__, ## __VA_ARGS__);		\
+} while (0)
+#define	NETDDEBUG_IF(i, f, ...) do {					\
+	if (nd_debug > 0)						\
+		if_printf((i), ("%s: " f), __func__, ## __VA_ARGS__);	\
+} while (0)
+#define	NETDDEBUGV(f, ...) do {						\
+	if (nd_debug > 1)						\
+		printf(("%s: " f), __func__, ## __VA_ARGS__);		\
+} while (0)
+#define	NETDDEBUGV_IF(i, f, ...) do {					\
+	if (nd_debug > 1)						\
+		if_printf((i), ("%s: " f), __func__, ## __VA_ARGS__);	\
+} while (0)
 
 static int	 netdump_arp_gw(void);
 static void	 netdump_cleanup(void);
@@ -150,6 +146,10 @@ FEATURE(netdump, "Netdump client support");
 static SYSCTL_NODE(_net, OID_AUTO, netdump, CTLFLAG_RD, NULL,
     "netdump parameters");
 
+static int nd_debug;
+SYSCTL_INT(_net_netdump, OID_AUTO, debug, CTLFLAG_RWTUN,
+    &nd_debug, 0,
+    "Debug message verbosity");
 static int nd_enabled;
 SYSCTL_INT(_net_netdump, OID_AUTO, enabled, CTLFLAG_RD,
     &nd_enabled, 0,


More information about the svn-src-user mailing list