I'm playing with NETDUMP kernel feature and dumpon manpage says that both -z and -Z options are accepted. But they're not? Specifying -z or -Z like this: dumpon -Z -s IP1 -c IP2 fails with: dumpon: ioctl(NETDUMPSCONF): Invalid argument
This is on HardenedBSD but I expect they don't have related changes. At least we should clarify the situation in the manpage.
Hidden in the CAVEATS section of the man page we have: -Z requires a kernel compiled with the ZSTDIO kernel option. so my first question is whether your kernel indeed has these options. "sysctl kern.conftxt | grep ZSTDIO" should tell you. FreeBSD GENERIC has them but if this is HardenedBSD (how do we know?) then presumably there is some custom config.
(In reply to Mark Johnston from comment #2) Perhaps we can handle EINVAL by retrying the ioctl w/ compression turned off, and if that works emitting a warning that -z/-Z was ignored, kernel likely does not have support?
Something like (completely untested): + if (error == EINVAL && netdump && (gzip || zstd)) { + /* Retry w/o compression in case kernel lacks support. */ + kdap->kda_compression = KERNELDUMP_COMP_NONE; + error = ioctl(fd, DIOCSKERNELDUMP, kdap); + if (error == 0) { + warnx("Compression disabled; kernel may lack gzip or " + "zstd support."); + } else { + error = errno; + } + }
(In reply to Ed Maste from comment #4) That seems reasonable to me. I don't think it should be restricted to netdump though.
(In reply to Mark Johnston from comment #5) Ah, of course. Just + if (error == EINVAL && (gzip || zstd)) {
(In reply to Ed Maste from comment #6) LGTM. Will you post a patch to phabricator?
@dmilith would you kindly try the patch in review? https://reviews.freebsd.org/D34520
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2b20327ec9394754c0bac2d83567b972a08e3930 commit 2b20327ec9394754c0bac2d83567b972a08e3930 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-03-10 18:04:34 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-03-16 16:08:28 +0000 dumpon: proceed without compression if the kernel lacks support PR: 252554 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34520 sbin/dumpon/dumpon.c | 9 +++++++++ 1 file changed, 9 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fbc0c2a21b761f676050e8769ef6ea498c0ac579 commit fbc0c2a21b761f676050e8769ef6ea498c0ac579 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-03-10 18:04:34 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-04-10 23:12:30 +0000 dumpon: proceed without compression if the kernel lacks support PR: 252554 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34520 (cherry picked from commit 2b20327ec9394754c0bac2d83567b972a08e3930) sbin/dumpon/dumpon.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Believed fixed in main and stable/13 now, @dmilith please submit another PR if you still encounter an issue related to this.