From owner-svn-src-user@freebsd.org Tue Apr 24 14:52:18 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C636FFA81D8 for ; Tue, 24 Apr 2018 14:52:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C1F278125; Tue, 24 Apr 2018 14:52:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 770E5149D8; Tue, 24 Apr 2018 14:52:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3OEqI30061823; Tue, 24 Apr 2018 14:52:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3OEqIOw061820; Tue, 24 Apr 2018 14:52:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804241452.w3OEqIOw061820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 24 Apr 2018 14:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r332937 - in user/markj/netdump/sys: conf netinet/netdump X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in user/markj/netdump/sys: conf netinet/netdump X-SVN-Commit-Revision: 332937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2018 14:52:19 -0000 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 #include -#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,