From owner-dev-commits-src-main@freebsd.org Mon Jul 26 20:10:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA5CB67419B; Mon, 26 Jul 2021 20:10:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYWJ037DLz3vZ0; Mon, 26 Jul 2021 20:10:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42D501D3D5; Mon, 26 Jul 2021 20:10:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QKAOEZ022953; Mon, 26 Jul 2021 20:10:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QKAOSj022952; Mon, 26 Jul 2021 20:10:24 GMT (envelope-from git) Date: Mon, 26 Jul 2021 20:10:24 GMT Message-Id: <202107262010.16QKAOSj022952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: accff08c2f6a - main - dumpon: Fix unconfiguring netdump with "off" and "/dev/null". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: accff08c2f6a8d1e36118993db5a792862cc3839 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 20:10:24 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=accff08c2f6a8d1e36118993db5a792862cc3839 commit accff08c2f6a8d1e36118993db5a792862cc3839 Author: Bryan Drewery AuthorDate: 2021-07-24 21:18:23 +0000 Commit: Bryan Drewery CommitDate: 2021-07-26 20:08:59 +0000 dumpon: Fix unconfiguring netdump with "off" and "/dev/null". Netdump has its own configuration tracking such that ioctl(/dev/null, DIOCSKERNELDUMP) does a dumper_remove() but does not notify netdump about the removal. Simply sending the same ioctl to /dev/netdump handles the situation. Reviewed by: markj, cem Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31300 --- sbin/dumpon/dumpon.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c index ef1eb3defc98..e83994d01314 100644 --- a/sbin/dumpon/dumpon.c +++ b/sbin/dumpon/dumpon.c @@ -550,6 +550,24 @@ main(int argc, char *argv[]) } else dev = argv[0]; netdump = false; + + if (strcmp(dev, _PATH_DEVNULL) == 0) { + /* + * Netdump has its own configuration tracking that + * is not removed when using /dev/null. + */ + fd = open(_PATH_NETDUMP, O_RDONLY); + if (fd != -1) { + bzero(&ndconf, sizeof(ndconf)); + ndconf.kda_index = KDA_REMOVE_ALL; + ndconf.kda_af = AF_INET; + error = ioctl(fd, DIOCSKERNELDUMP, &ndconf); + if (error != 0) + err(1, "ioctl(%s, DIOCSKERNELDUMP)", + _PATH_NETDUMP); + close(fd); + } + } } else usage();