git: accff08c2f6a - main - dumpon: Fix unconfiguring netdump with "off" and "/dev/null".

Bryan Drewery bdrewery at FreeBSD.org
Mon Jul 26 20:10:24 UTC 2021


The branch main has been updated by bdrewery:

URL: https://cgit.FreeBSD.org/src/commit/?id=accff08c2f6a8d1e36118993db5a792862cc3839

commit accff08c2f6a8d1e36118993db5a792862cc3839
Author:     Bryan Drewery <bdrewery at FreeBSD.org>
AuthorDate: 2021-07-24 21:18:23 +0000
Commit:     Bryan Drewery <bdrewery at FreeBSD.org>
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();
 


More information about the dev-commits-src-all mailing list