Commit graph

9664 commits

Author SHA1 Message Date
Kristof Provost 34055dacee ipfw: Introduce dnctl
Introduce a link to the ipfw command, dnctl, for dummynet configuration.
dnctl only handles dummynet configuration, and is part of the effort to
support dummynet in pf.

/sbin/ipfw continues to accept pipe, queue and sched commands, but these can
now also be issued via the new dnctl command.

Reviewed by:	donner
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30465

(cherry picked from commit 0b95680e07)
2021-09-14 22:00:24 +02:00
Kristof Provost c298e0a0c2 pfctl: print counters in decimal
795d78a467 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by:	Florian Smeets
MFC after:	4 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 846a6e8f9a)
2021-09-08 09:28:29 +02:00
Kristof Provost 0c976ab9c0 pfctl: Don't use PRIu64
Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after:	1 week
Suggested by:	kib
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 795d78a467)
2021-09-08 09:28:25 +02:00
Mark Johnston 9c82ba2473 mdconfig: Add a regression test for mediasize rounding
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ed59446b47)
2021-09-07 09:36:18 -04:00
Dimitry Andric a80a3afc3b Fix -Wformat errors in pfctl on 32-bit architectures
Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result
in "error: format specifies type 'unsigned long' but the argument has
type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit
architectures.

Fixes:		80078d9d38
MFC after:	1 week

(cherry picked from commit 5b8f07b12f)
2021-09-06 15:42:53 +02:00
Kristof Provost 7c544989af pfctl: use libpfctl to retrieve pf status
Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31697

(cherry picked from commit 80078d9d38)
2021-09-06 10:06:36 +02:00
Gordon Bergling aa9d47d9de Fix a common typo in man pages and src comments
- s/desciptor/descriptor/

(cherry picked from commit b1603638e3)
2021-09-02 08:13:48 +02:00
Kristof Provost d4c7ab9b1d pfctl: build fix
Fix the build issue introduced in e59eff9ad3 (pfctl: fix killing states by ID)

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 9ce320820e)
2021-08-31 09:47:47 +02:00
Kristof Provost b8110a4d73 pfctl: fix killing states by ID
Since the conversion to the new DIOCKILLSTATESNV the kernel no longer
exists the id and creatorid to be big-endian.
As a result killing states by id (i.e. `pfctl -k id -k 12345`) no longer
worked.

Reported by:	Özkan KIRIK
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e59eff9ad3)
2021-08-31 09:47:20 +02:00
Luiz Otavio O Souza 09e25aff54 ipfw: use unsigned int for dummynet bandwidth
This allows the maximum value of 4294967295 (~4Gb/s) instead of previous
value of 2147483647 (~2Gb/s).

Reviewed by:	np, scottl
Obtained from:	pfSense
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31582

(cherry picked from commit 20ffd88ed5)
2021-08-26 14:05:26 +02:00
Franco Fichtner 75df39760c dhclient: remove patching of static values in BPF programs
Reviewed by:	markj

(cherry picked from commit 5851803f4b)
2021-08-26 07:46:11 -04:00
Franco Fichtner 3bcf919c4e dhclient: skip_to_semi() consumes semicolon already
When invalid statement is found the next statement is skipped even if it
is valid.

Reviewed by:	markj

(cherry picked from commit a313b5240a)
2021-08-26 07:46:01 -04:00
Kyle Evans 9ee8e86c0d init: execute /etc/rc.final after all user processes have terminated
This can be useful for, e.g., unmounting filesystems that were needed
for shutdown.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#63

(cherry picked from commit 4d15976919)
2021-08-26 01:42:00 -05:00
Fabian Kurtz 8751bff1a7 dhclient: support supersede statement for option 54
PR:		217978
Reported by:	Franco Fichtner <franco@opnsense.org>
Reviewed by:	markj
Obtained from:	OPNsense
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31503

(cherry picked from commit 0a539a0f00)
2021-08-25 16:54:05 -07:00
Gordon Tetlow 0729ba2f49 Fix remote code execution in ggatec(8).
Approved by:    so
Security:       SA-21:14.ggatec
Security:       CVE-2021-29630

(cherry picked from commit 515216929c40169cc72b62466ff9238682661613)
2021-08-24 10:50:50 -07:00
Gordon Bergling df82424970 md5(1): Fix a typo in the manual page
- s/compatibilty/compatibility/

(cherry picked from commit 0d71cea832)
2021-08-19 09:29:01 +02:00
Emmanuel Vadot e6a32ddf3f pkgbase: Add nfsiod to the FreeBSD-nfs package
Missed in 081fb64492

(cherry picked from commit e06b8f1128)
2021-08-16 18:15:47 +02:00
Gordon Bergling 71a74e2168 ipfw(8): Fix a typo in an error message
- s/suport/support/

(cherry picked from commit 809ad8170a)
2021-08-16 07:20:31 +02:00
Gordon Bergling bb15117761 iscontrol(8): Fix a typo in a struct
- s/suport/support/

(cherry picked from commit 1e1fbf3b47)
2021-08-16 07:20:00 +02:00
Roy Marples f452713408 socket: Implement SO_RERROR
SO_RERROR indicates that receive buffer overflows should be handled as
errors. Historically receive buffer overflows have been ignored and
programs could not tell if they missed messages or messages had been
truncated because of overflows. Since programs historically do not
expect to get receive overflow errors, this behavior is not the
default.

This is really really important for programs that use route(4) to keep
in sync with the system. If we loose a message then we need to reload
the full system state, otherwise the behaviour from that point is
undefined and can lead to chasing bogus bug reports.

Reviewed by:	philip (network), kbowling (transport), gbe (manpages)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26652

(cherry picked from commit 7045b1603b)
2021-08-10 18:54:00 -07:00
Rick Macklem 46b4c26b5b mount_nfs.8: Add information for "nconnect" to man page
Commit 1e0a518d65 added a new NFS mount option "nconnect".
This patch adds information on this option to the man page.

It also adds an IMPLEMENTATION section that explains how
the default I/O size is determined and that "nfsstat -m" can
be used to find out what option settings are actually in use.

This is a content change.

(cherry picked from commit 4488c8c34b)
2021-08-03 16:49:28 -07:00
Luiz Otavio O Souza 50ecd99be5 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf
This allows the use of VLAN PCP in dhclient, which is required for
certain ISPs (such as Orange.fr).

Reviewed by:	bcr (man page)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31263

(cherry picked from commit 1e7fe2fbb9)
2021-08-02 16:50:32 +02:00
Kristof Provost 70d4a7a966 pf: match keyword support
Support the 'match' keyword.
Note that support is limited to adding queuing information, so without
ALTQ support in the kernel setting match rules is pointless.

For the avoidance of doubt: this is NOT full support for the match
keyword as found in OpenBSD's pf. That could potentially be built on top
of this, but this commit is NOT that.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31115

(cherry picked from commit ef950daa35)
2021-07-31 10:12:02 +02:00
Alan Somers 1b58943ef8 [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
Sponsored by:	Axcient

(cherry picked from commit 3874c0abb0)
2021-07-27 11:57:17 -06:00
Kristof Provost 720b82f821 pfctl: syncookie configuration
pfctl and libpfctl code required to enable/disable the syncookie
feature.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31140

(cherry picked from commit c69121c473)
2021-07-27 09:43:52 +02:00
Warner Losh 5b194853b9 devd: remove pccard entries
The pccard entries are now obsolete, remove them.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31184

(cherry picked from commit a535413556)
2021-07-21 10:13:12 -06:00
Julien Grall 7ca3061f84 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

(cherry picked from commit 2b2c460d7b)
2021-07-21 13:07:34 -03:00
Elliott Mitchell ddefb003ee 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

(cherry picked from commit c76616f496)
2021-07-21 13:05:01 -03:00
Warner Losh ad0c23cdcd ttys: diff reduction
Back in the day, we used to have a number of entries that were either
'on' or 'off' directly, rather than conditionally on 'onifexists'
etc. Back then, we tried to line up the 'secure' columns by using the
construct 'on secure' or 'off secure' (one space or two). Now that these
have all moved to a conditional construct, remove the second space on
the ttys that still have it. This reduces diffs between the different
ttys and is no functional change. i386 and amd64 did this a long time
ago, and those are the only ones that affected external users (who used
to sed 's/on /off /' the entires as part of the automation).

MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit 36be84b966)
2021-07-21 13:04:43 -03:00
Alexander Motin 7de125a406 Partially revert previous commit.
ns identify does not allow nsid of 0xffffffff.  Only general identify
allows it.

MFC after:	1 week

(cherry picked from commit d1a0eab9fb)
2021-07-20 21:56:36 -04:00
Alexander Motin d92453e8b0 For ns identify/delete allow nsid of 0xffffffff.
The first should report common parameters, the second should delete
all namespaces.

MFC after:	1 week

(cherry picked from commit dbf1dce8d6)
2021-07-20 21:56:36 -04:00
Alexander Motin 0b1b2d6882 Filter out LBA formats with LBA Data Size of 0.
According to the spec: "If the value reported is 0h, then LBA format
is not supported / used or is not currently available".

MFC after:	1 week

(cherry picked from commit d379886a41)
2021-07-20 21:54:38 -04:00
Robert Wing fb2feceac3 fsck_ffs: fix background fsck in preen mode
Background checks are only allowed for mounted filesystems - don't try
to open the device for writing when performing a background check.

While here, remove a debugging printf that's commented out.

PR:             256746
Fixes:          5cc52631b3
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D30880

(cherry picked from commit 0c5a59252c)
2021-07-19 10:06:53 -08:00
Bjoern A. Zeeb 05490438f2 ifconfig: 80211, add line break after key info
Beauty correction for verbose mode or in case we print multiple key
information to not continue with the next options directly after
as we did so far, e.g.:
	AES-CCM 2:128-bit
	AES-CCM 3:128-bit powersavemode ...

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D29393

(cherry picked from commit 5ba4c8de15)
2021-07-18 00:34:57 +00:00
Edward Tomasz Napierala 5a604e56d4 nvmecontrol: fix typo (s/Managment/Management/)
Reported By:	pstef

(cherry picked from commit 95a74ab4fb)
2021-07-12 14:37:07 -06:00
Warner Losh 99ff43c0c7 nvmecontrol: update copyright on passthru command
I wrote this code, not Intel, so put my copyright on this. I mistakenly
copied it for the initial commit.

Sponsored by:		Netflix

(cherry picked from commit 6d6cca3633)
2021-07-12 14:37:07 -06:00
Warner Losh d2299b7159 nvmecontrol: Report status from passthru commands
Report status from dword0 for passthru commands. Many commands report
some status or information here, so reporting it can help know what's
going on.

Sponsored by:		Netflix

(cherry picked from commit 510a3da147)
2021-07-12 14:37:07 -06:00
Warner Losh 39d7a1f479 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

(cherry picked from commit 445b5554bf)
2021-07-12 13:42:59 -06:00
Rick Macklem 50f2705d26 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).

(cherry picked from commit b413b03597)
2021-07-11 15:30:01 -07:00
Stefan Eßer 185dcb1072 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.

(cherry picked from commit b33d1898c1)
2021-07-06 16:56:06 +02:00
Mateusz Guzik d5fe617b09 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")

(cherry picked from commit 858937bea4)
2021-07-05 11:32:14 +00:00
Mark Johnston 2d4eba7f8e mdconfig tests: Correct a copy-pasted test description
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4420bb6a86)
2021-06-30 08:18:00 -04:00
Jessica Clarke a4f9c6a9e6 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.

(cherry picked from commit cab31e0e21)
2021-06-28 18:14:02 +02:00
Stefan Eßer 4048460078 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

(cherry picked from commit 84f35b6f86)
(cherry picked from commit c2870e576b)
2021-06-28 18:13:09 +02:00
Warner Losh 9ecf4bd8e9 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

(cherry picked from commit d0ea5e467f)
2021-06-28 18:03:38 +02:00
Warner Losh c0d5665be0 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

(cherry picked from commit 086feed850)
2021-06-28 18:03:38 +02:00
Stefan Eßer cb6ebbaa48 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.

(cherry picked from commit 884fc5527a)

sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests

(Fix by lwhsu (Li-Wen Hsu) to un-break "make distribute".)

(cherry picked from commit cb194afef5)

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.

(cherry picked from commit 95d3044bbd)

Sponsored by:	The FreeBSD Foundation (commit cb194afef5 only)
2021-06-28 11:05:30 +02:00
Lutz Donnerhacke ef84d16e68 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
Differential Revision: https://reviews.freebsd.org/D30189

(cherry picked from commit c8250c5ada)
2021-06-18 11:53:26 +02:00
Robert Wing 01cf73198d 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

(cherry picked from commit 0e6549c874)
2021-06-11 09:28:41 -08:00
Robert Wing 47ec64b3e8 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
Differential Revision:  https://reviews.freebsd.org/D30537

(cherry picked from commit 441e69e419)
2021-06-11 08:56:00 -08:00