Commit Graph

9675 Commits

Author SHA1 Message Date
Warner Losh
445b5554bf nvmecontrol: document power command
The description of the power command is missing. While the synopsis is
present, there's no explanation. Add one.

Reviewed by:		mav, chuck
PR:			237866
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31122
2021-07-10 10:53:34 -06:00
Mateusz Guzik
1e67e3109d setkey: drop an unused argument from postproc 2021-07-08 14:00:55 +00:00
Mateusz Guzik
b29817874d setkey: fix several warnings popping up when compiling without WARNS=1 2021-07-08 14:00:55 +00:00
Mateusz Guzik
e0c0612d9b setkey: ansify 2021-07-08 14:00:55 +00:00
Alan Somers
3874c0abb0 [skip ci] correct a few SPDX license tags
These were all incorrectly labeled as 2-clause BSD licenses by a
semi-automated process, when in fact they are 3-clause.

Discussed with:	pfg, imp
MFC after:	2 weeks
Sponsored by:	Axcient
2021-07-07 13:52:20 -06:00
Julien Grall
2b2c460d7b etc/ttys: add xen console
Xen VMs get a simulated serial device meant for use as a console.  Often
an xterm or other advanced terminal is used, so use xterm as the type.

Depending on configuration, FreeBSD on Xen for amd64 may instead use an
emulated serial port, but the virtual console may also be available.

Submitted by:	Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by:	imp (slightly earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29873
2021-07-06 11:53:10 -03:00
Elliott Mitchell
c76616f496 etc/ttys: merge ttys file down to single file
The tty lists were already pretty similar and there hadn't been any real
need for them to remain distinct for some time. As such, merge to a
single file.

The RISC-V console is preserved. For systems where it doesn't exist, its
presence in /etc/ttys is harmless. The uncommented version of the
ttyv8/XDM line from ttys.amd64 was the one chosen.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30256
2021-07-06 11:53:10 -03:00
Robert Wing
dc35484536 dumpfs(8): add option to only print superblock information
Add an option to dumpfs, `-s`, that only prints the super block information.

Reviewed by:	chs, imp
Differential Revision:	https://reviews.freebsd.org/D30881
2021-07-02 14:18:17 -08:00
Mateusz Guzik
858937bea4 pfctl: cache getprotobynumber results
As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.

Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after:	8.064u 1.117s 0:18.87 48.5%

Idea by Jim Thompson

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-01 21:31:45 +00:00
Fernando Apesteguía
0a0f748641 man: Build manpages for all architectures
Building and installing architecture-specific man pages only raises a number of
problems:

 * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an
   example, it does not show results for pae(4). The reason for this is
   that the cgi interface runs on FreeBSD amd64.

 * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr(4)
   for an example.

 * Also, we have broken links in our Release Notes. This is a
   consequence of the first point. See
   https://www.freebsd.org/releases/13.0R/hardware/#proc-i386.

Make MAN_ARCH default to 'all' so we build all the man pages for all the
architectures. The difference in disk space is negligible. Also link
architecture-specific man pages to their own section while keeping their own
namespace.

PR: 212290
Reported by:	mj@bsdops.com
Approved by:	ceri@, wosch@
MFC after:	4 weeks
2021-06-30 09:57:51 +02:00
Chuck Silvers
ed1a156b03 fsck_ffs: don't try to write in read-only mode
Skip trying to change fs_mtime for SU+J if we are running read-only.

Reviewed by:    mckusick
Sponsored by:	Netflix
2021-06-29 14:29:15 -07:00
Stefan Eßer
b33d1898c1 md5: Improve compatibility with coreutils and format fix
The previous changes that added support for the coreutils -c option
modified the output generated by passing -r to match that of the
coreutils versions. The difference is that coreutils separates the
hash from the file name by two blanks "  " (or a blank followed by
an asterisk " *" with the -b option denoting).

While most scripts or users will not notice the difference, it might
be considered a violation of POLA and this commit reverts the change
for the non-sum programs. These will print a single blank " " as the
separator, as they die before the previous commit.

In order to still generate output that is identical to that of the
coreutils programs, this commit generates the "  " or " *" separator
used by them for the -sum versions, depending on the presence of the
-b option.

MFC after:	3 days
2021-06-29 09:21:57 +02:00
Rick Macklem
b413b03597 mount_nfs.8: Update the man page for commit a145cf3f73
The NFSv4 client now uses the highest minor version of NFSv4
by default instead of minor version 0, for NFSv4 mounts.
The "minorversion" mount option may be used to override this default.

This patch updates the man page to reflect this change.  While here,
fix nfsstat(8) to be nfsstat(1).

Reviewed by:	otis
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30768
2021-06-26 14:09:28 -07:00
Jessica Clarke
cab31e0e21 md5: Fix cross-build after c2870e576b
On macOS and Linux the current set of headers do not end up pulling in
sys/param.h, causing MAXPATHLEN to not be defined and the build to fail.
2021-06-25 22:00:11 +01:00
Stefan Eßer
1b4ac90665 sbin/md5: re-enable tests
The directory for the tests was missing in BSD.tests.dist, causing
build failures in "make distribute".

Li-Wen Hsu fixed this issue in commit cb194afef5, allowing me to
re-enable installation of the tests.

MFC after:	3 days
2021-06-25 12:41:14 +02:00
Stefan Eßer
3268f407ca sbin/md5: disable tests due to build failures
Testing with buildworld/installworld had succeeded, but it appears
that a path is not correctly set for the distribute target in the
tests directory.

Commenting out HAS_TESTS should make the build succeed again and give
time to resolve the "make distribute" issue.

The tests have been locally run to verify that the recent changes to
add a coreutils compatible -c option does not lead to any regressions.
2021-06-25 12:14:25 +02:00
Stefan Eßer
95d3044bbd sbin/md5: fix test case to not write outside temp directory
The bsd-p-test did create files 1.out .. 8.out in the test directory.
This has been fixed and the temporary output files are now written
to the temporary directory.

MFC after:	3 days
2021-06-25 10:37:51 +02:00
Stefan Eßer
c2870e576b sbin/md5: improve compatibility with coreutils -c option
The -c option expects a digest file in either BSD or coreutils format.

The output for matched and mismatched files is identical to that
of the coreutils version.

The review of these changes included test cases that have already
been committed for the functionality that existed before.
Another test script is added to cover the coreutils compatible
extension implemented by this patch.

This commit contains a tests/Makefile that has been cleaned up
compared to the review version, using an implicit rule to apply the
TESTBASE path at build time (and the scripts have been renamed to
have an extension of .SH instead of .sh to trigger this rule).

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D30812
2021-06-25 08:54:36 +02:00
Stefan Eßer
884fc5527a sbin/md5: add tests
While the correctness of the supported hash algorithms can be tested
with the built-in self-test feature, these test cases are meant to
detect changes in the output format.

A follow-up commit will	improve	the compatibility with the coreutils
versions of the hash programs, and these tests should detect any
unintended side-effects	of such	a change on existing functionality.
2021-06-25 08:51:40 +02:00
Rozhuk Ivan
a75819461e devctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET
Add devd event on network iface address add/remove.  Can be used to
automate actions on any address change.

Reviewed by:		imp@ (and minor style tweaks)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30840
2021-06-23 10:26:56 -06:00
Rozhuk Ivan
4fb3e0bb94 devctl: add RENAME devctl event for IFNET
Add devd event on network iface rename.

Reviewed by:		imp@,asomers@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30839
2021-06-23 10:20:58 -06:00
Mark Johnston
4420bb6a86 mdconfig tests: Correct a copy-pasted test description
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-06-23 10:37:40 -04:00
Stefan Eßer
84f35b6f86 sbin/md5: add md5sum to synopsis in the man-page
When invoked with "sum" following the hash name, the -c option takes a
file argument, not a string argument.
2021-06-19 13:27:16 +02:00
Allan Jude
c6a311678d nextboot: Improve the shell code used to figure out the zpool name
Reported by:	imp
Reviewed by:	imp, tsoome
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D30650
2021-06-05 14:32:18 +00:00
Lutz Donnerhacke
c8250c5ada ipfw.8: synopsis misses nat show form
Document the existing behavior, which is currently only available by
reading third party documentation or the source code itself.

PR:		254617
Submitted by:	Oliver Kiddle
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30189
2021-06-04 12:55:59 +02:00
Robert Wing
0e6549c874 bectl(8): don't allow creation of boot environments with spaces
Boot environment datasets that contain spaces are not bootable.

When a user attempts to create a boot environment with a space, abort
the creation and print an error message.

PR:             254441
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D30194
2021-06-03 08:36:11 -08:00
Robert Wing
441e69e419 fsck_ufs: fix segfault with gjournal
The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while
attempting to traverse the buffer cache. The tail queue used for the
buffer cache was not initialized before dropping into gjournal_check().

Initialize the buffer cache before calling gjournal_check().

PR:             245907
Reviewed by:    jhb, mckusick
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D30537
2021-06-02 18:30:20 -08:00
sebastien.bini
e5be21d19b sbin/veriexec: fixed parameter parsing of option -x
The -x parameter doesn't take any arguments. It says that all further
arguments are paths to check.

Reviewed by:	imp@
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/443/files
2021-06-02 15:37:51 -06:00
Robert Wing
9b0f1d64b0 Revert "Fix fsck_ufs segfaults with gjournal (SU+J)"
Fix fsck for 32-bit platforms.

This reverts commit f190f9193b.
2021-05-28 18:59:07 -08:00
Robert Wing
871291c8d4 Revert "fsdb: add missing bufinit() call"
This reverts commit 84768d1149.
2021-05-28 18:51:25 -08:00
Kirk McKusick
5c9e9eb7a2 Fix fsck_ufs segfault when it needs to rerun.
The segfault was being hit in the rerun of Pass 1 in ginode() when
trying to get an inode that needs to be repaired. When the first run
of fsck_ffs finishes it clears the inode cache, but ginode() was
failing to check properly and tried to access the deallocated cache entry.

Reported by:  Peter Holm
Reviewed by:  Chuck Silvers
Tested by:    Peter Holm and Chuck Silvers
MFC after:    3 days
Sponsored by: Netflix
2021-05-28 19:41:50 -07:00
Chuck Silvers
84768d1149 fsdb: add missing bufinit() call
The bufinit() call in fsck_ffs was moved in commit f190f9193b
from a function that is shared with fsdb to one that is private to fsck_ffs,
so add a bufinit() call in fsdb to compensate for that.

Reviewed by:	mckusick
Sponsored by:	Netflix
2021-05-25 09:42:10 -07:00
Robert Wing
20123b25ee fsck_ffs(8): fix divide by zero when debug messages are enabled
Only print buffer cache debug message when a cache lookup has been done.

When running `fsck_ffs -d` on a gjournal'ed filesystem, it's possible
that totalreads is greater than zero when no cache lookup has been
done - causing a divide by zero. This commit fixes the following error:

    Floating point exception (core dumped)

Reviewed by:    mckusick
Differential Revision:  https://reviews.freebsd.org/D30370
2021-05-22 11:03:36 -08:00
Kirk McKusick
f190f9193b Fix fsck_ufs segfaults with gjournal (SU+J)
The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c)
while attempting to traverse the buffer cache to flush dirty buffers.
The tail queue used for the buffer cache was not initialized before
dropping into gjournal_check(). Move the buffer initialization earlier
so that it has been done before calling gjournal_check().

Reported by:  crypt47, nvass
Fix by:       Robert Wing
Tested by:    Robert Wing
PR:           255030
PR:           255979
MFC after:    3 days
Sponsored by: Netflix
2021-05-21 13:42:37 -07:00
Konstantin Belousov
a19e14ca2d ldconfig(8): update manpage to reality
ELF ldconfig only maintains the search list, there is no hints

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30272
2021-05-21 19:51:18 +03:00
Warner Losh
d0ea5e467f md5: portability fix -- include stdbool.h explicitly
stdbool.h needs to be included to use type bool variables. Due to
namespace pollution, this gets brought in on FreeBSD, but not on
other systems. Include it explicilty.

Noticed by:		arichards@
Sponsored by:		Netflix
2021-05-20 11:28:18 -06:00
Kristof Provost
9938fcaa65 pfctl tests: Test fairq configuration
We used to have a bug where pfctl could crash setting fairq queues. Test
this case and ensure it does not crash pfctl.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30348
2021-05-20 14:06:23 +02:00
Kristof Provost
dc78428796 pfctl: Ensure parent queue is configured for FAIRQ
We failed to account for the FAIRQ scheduler in expand_altq(), which led
it to be set up without its parent queue.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30347
2021-05-20 14:06:23 +02:00
Kristof Provost
26705a39e5 pfctl: Fix crash on ALTQ configuration
The following config could crash pfctl:
	altq on igb0 fairq bandwidth 1Gb queue { qLink }
	queue qLink fairq(default)

That happens because when we're parsing the parent queue (on igb0) it
doesn't have a parent, and the check in eval_pfqueue_fairq() checks
pa->parent rather than parent.

This was changed in eval_pfqueue_hfsc() in
1d34c9dac8, but not for fairq.

Reviewed by:	pkelsey
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30346
2021-05-20 14:06:22 +02:00
Kristof Provost
d0fdf2b28f pf: Track the original kif for floating states
Track (and display) the interface that created a state, even if it's a
floating state (and thus uses virtual interface 'all').

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30245
2021-05-20 12:49:27 +02:00
Kristof Provost
bc94129147 pfctl: Use DIOCGETSTATESNV
Migrate to using the new nvlist-based DIOCGETSTATESNV call to obtain the
states list.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30244
2021-05-20 12:49:27 +02:00
Kirk McKusick
fe815b88b5 Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".
Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks.
Pass 1 only knows that a block is duplicate when it finds the second
instance of its use. The role of Pass 1b is to find the first use
of all the duplicate blocks. It makes a pass over the cylinder groups
looking for these blocks. When moving to the next cylinder group,
Pass 1b failed to properly calculate the starting inode number for
the cylinder group resulting in the above error message when it
tried to read the first inode in the cylinder group.

Reported by:  Px
Tested by:    Px
PR:           255979
MFC after:    3 days
Sponsored by: Netflix
2021-05-19 14:39:24 -07:00
Warner Losh
086feed850 md5: Create md5sum, etc compatible programs
On Linux, there's a similar set of programs to ours, but that end in the
letters 'sum'. These act basically like FreeBSD versions run with the -r
option. Add code so that when the program ends in 'sum' you get the
linux -r behavior. This is enough to make most things that use sha*sum
work correctly (the -c / --check options, as well as the long args are
not implemented). When running with the -sum programs, ignore -t instead
of running internal speed tests and make -c an error.

Reviewed by:		sef, and kp and allanjude (earlier version)
Relnotes:		yes
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30309
2021-05-19 11:41:53 -06:00
Kirk McKusick
efe145a745 Correct assert added to dump program.
The dump program was exiting with the message:

Assertion failed: (spcl.c_count + blks < TP_NINDIR), function appendextdata, file /usr/src/sbin/dump/traverse.c, line 759.

The problem arose when dumping external attributes.

This assertion was added in this commit with no review by someone
with expertise in the dump program:

    commit 2d518c6518
    Author:     Warner Losh <imp@FreeBSD.org>
    AuthorDate: Mon Jun 11 19:32:36 2018 +0000
    Commit:     Warner Losh <imp@FreeBSD.org>
    CommitDate: Mon Jun 11 19:32:36 2018 +0000

	Add asserts to prevent overflows of c_addr.

It is clearly wrong as the statement immediately above it in the
code which is deciding if the data will fit is:

	if (spcl.c_count + blks > TP_NINDIR)
		return (0);

As is pointed out in the bug report, the assert should be:

	(spcl.c_count + blks <= TP_NINDIR)

This commit corrects the assert. I am sorry that it took so long to
be brought to my attention and get fixed.

Reported by:  Hampton Finger
PR:           244470
MFC after:    3 days
Sponsored by: Netflix
2021-05-17 16:34:53 -07:00
Kirk McKusick
a3628327e7 Ensure that files with no allocated blocks are trimmed to zero length.
UFS does not allow files to end with a hole; it requires that the
last block of a file be allocated. As fsck_ffs(8) initially scans
each allocated inode, it tracks the last allocated block in the
inode. It then checks that the inode's size falls in the last
allocated block. If the last allocated block falls before the size,
a `file size beyond end of allocated file' warning is issued and
the file is shortened to reference the last allocated block (to avoid
having it reference a hole at its end). If the last allocated block
falls after the size, a `partially truncated file' warning is issued
and all blocks following the block referenced by the size are freed.

Because of an incorrect unsigned comparison, this test was failing
to handle files with no allocated blocks but non-zero size (which
should have had their size reset to zero). Once that was fixed the
test started incorrectly complaining about short symbolic links
that place the link path in the inode rather than in a disk block.
Because these symbolic links have a non-zero size, but no allocated
blocks, fsck_ffs wanted to zero out their size. This patch has to
detect and avoid changing the size of such symbolic links.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix
2021-05-11 14:52:26 -07:00
Lutz Donnerhacke
802637be06 ipfw.8: Fix table example
Fix some erronous lines in the example section.

PR:		248943
Submitted by:	Jose Luis Duran
MFC after:	2 weeks
Reviewers:	ae, manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D30191
2021-05-11 17:38:26 +02:00
Lutz Donnerhacke
f6f297871d sbin/ipfw: Allow tablearg as hostname
Hostnames starting with "tablearg" are considered as a functional
argument instead of a literal.

Reported by:	ae
Reviewers:	ae
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30208
2021-05-11 10:44:33 +02:00
Lutz Donnerhacke
6cb13813ca sbin/ipfw: Fix parsing error in table based forward
The argument parser does not recognise the optional port for an
"tablearg" argument.  Fix simplifies the code by make the internal
representation expicit for the parser.

PR:		252744
MFC:		1 week
Reported by:	<bugs.freebsd.org@mx.zzux.com>
Approved by:	nc
Tested by:	<bugs.freebsd.org@mx.zzux.com>
Differential Revision: https://reviews.freebsd.org/D30164
2021-05-08 22:52:17 +02:00
Kristof Provost
93abcf17e6 pf: Support killing 'matching' states
Optionally also kill states that match (i.e. are the NATed state or
opposite direction state entry for) the state we're killing.

See also https://redmine.pfsense.org/issues/8555

Submitted by:	Steven Brown
Reviewed by:	bcr (man page)
Obtained from:	https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30092
2021-05-07 22:13:31 +02:00
Kristof Provost
abbcba9cf5 pf: Allow states to by killed per 'gateway'
This allows us to kill states created from a rule with route-to/reply-to
set.  This is particularly useful in multi-wan setups, where one of the
WAN links goes down.

Submitted by:	Steven Brown
Obtained from:	https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30058
2021-05-07 22:13:31 +02:00