Commit Graph

10648 Commits

Author SHA1 Message Date
Kristof Provost
470a2b3346 pf: convert DIOCSETSTATUSIF to netlink
While here also add a basic test case for it.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44368
2024-03-19 16:30:08 +01:00
Dag-Erling Smørgrav
a46217ce7d bectl: Simplify command aliases.
MFC after:	3 days
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44406
2024-03-18 14:49:23 +01:00
Dag-Erling Smørgrav
e819534f15 bectl: Use geopt() and drop mention of -?.
MFC after:	3 days
PR:		272260
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44405
2024-03-18 14:49:18 +01:00
PauAmma
140119a60d ifconfig.8: add missing "be"
Reviewed by:	allanjude, bjk
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44022
2024-03-15 14:16:53 -07:00
John Baldwin
1b38f851d8 nvmecontrol: Update the test for a valid firmare revision slot
Reported by:	Coverity Scan
CID:		1539214
Fixes:		7485926e09 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
2024-03-15 08:18:47 -07:00
Dag-Erling Smørgrav
b53ae8a833 ping: Fix protocol selection with NOINET6 kernel.
A missing else caused the correct resolver hint (AF_INET) to be
overwritten with AF_UNSPEC when the kernel supports IPv4 but not
IPv6.

MFC after:	3 days
PR:		277592
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44304
2024-03-12 20:40:36 +01:00
Gordon Bergling
f3343fe4a6 md5.1: Fix the GNU mode example when using a digest file
The last example in the manpage md5(1) wants to demonstrate
GNU mode (md5sum), but uses BSD mode (md5) instead.

In GNU mode, the -c option does not compare against a hash string
passed as parameter. Instead, it expects a digest file,
as created under the name digest for /boot/loader.conf in
the example above.

PR:	276560
Reviewed by:	mhorne, des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44098
2024-03-12 15:44:48 +01:00
Konstantin Belousov
bdf1587a49 mount_nullfs(8): fix typo
Reported by:	mckusick
2024-03-09 23:18:39 +02:00
Konstantin Belousov
4a2a69c447 mount_nullfs(8): document -o cache and vfs.nullfs.cache_vnodes
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-08 20:44:21 +02:00
Warner Losh
7c6af20969 devd: Add directory information
Devd searches /etc/devd and /usr/local/etc/devd by default (given the
default devd.conf file). Document that here.

Sponsored by:		Netflix
2024-03-06 18:38:59 -07:00
Warner Losh
6a3877a0e2 devd: Document the nvme devd events
Nvme informs devd of smart and reset controller events. Document them.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44212
2024-03-06 18:38:59 -07:00
Gordon Bergling
a44658281a Revert "md5.1: Fix an example"
This reverts commit 865baeaf1a.
2024-03-06 09:34:30 +01:00
John Baldwin
7485926e09 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
In particular, don't try to byteswap the values as 64-bit integers and
always print a non-empty version as a string.

Reviewed by:	chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44121
2024-03-01 14:18:43 -08:00
Stefan Eßer
484de86fbe ldconfig: remove ignored -v (verbose) option
The -v option used to print useful information when operating on a.out
format libraries. After the removal of a.out support, it was accepted
but did not have any effect.

Remove the option and update the man-page.

While here mention the set of historic options that are accepted but
ignored: "-elf", "-s", and "-v".

The FILES section contained outdated information and did not mention
the way library directories of optional ports and packages are
included in the library search path recorded in the hints file.

The description of the "-B" option was incorrect (described a planned
change) for big-endian platforms (powerpc64). These do still default
to big-endian hints files, since the current version of the "pkg"
program expects the hints file to be in native byte-order.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44139
2024-03-01 16:40:55 +01:00
Kristof Provost
706d465dae pf: convert kill/clear state to use netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44090
2024-02-28 23:26:18 +01:00
Stefan Eßer
e0dfecadf5 ldconfig: support hints files of either byte-order
Make the ldconfig program accept hints files in little-endian and
big-endian format on all architectures.

The default format is the native byte-order of the respective host.
This is expected to change when a version of the pkg command is
available that implements support for either byte-order in its
internal ldconfig function. (Already committed in the development
tree of the pkg utility, a release is expected at the end of Q1/2024).

This update adds the -B option to the ldconfig program. It enforces
the creation of a big-endian hints file on a little-endian host.
The main purpose to is support of tests with non-native byte-order
files on little-endian hosts. It will be removed when all supported
FreeBSD releases use little-endian hints files by default.

When little-endian hints files are generally used, support of
either byte-order in libexec/rtld can also be removed.

When support for big-endian hints files is no longer required,
the COND_SWAP macro in ldconfig and rtld shall be replaced by
le32toh(), which just return their argument on little-endian
architectures.

Approved by:	kib
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D44093
2024-02-28 18:49:29 +01:00
Stefan Schlosser
865baeaf1a md5.1: Fix an example
The last example in the manpage md5(1) wants to demonstrate
GNU mode (md5sum), but uses BSD mode (md5) instead:

In GNU mode, the -c option does not compare against a hash string
passed as parameter. Instead, it expects a  digest file,
as created under the name digest for /boot/loader.conf in
the example above.

PR:	276560
Reviewed by:	mhorne
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44098
2024-02-28 09:31:28 +01:00
Stefan Schlosser
77f6c0ce92 nvmecontrol.8: Fix the SYNOPSIS section
The manpage of nvmecontrol(8) has the following SYNOPSIS:

nvmecontrol format [-f fmt] [-m mset] [-o pi] [-l pil] [-E]
[-C] <device-id | namespace-id>

The correct switch for the pi option is -p according
to sbin/nvmecontrol/format.c:

OPT("pi", 'p', arg_uint32, opt, pi, "Protective information")

So correct the SYNOPSIS section accordingly.

PR:	276554
Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44099
2024-02-28 09:26:20 +01:00
Warner Losh
bad90cb4f6 nextboot: check unlink, but only warn on !ENOENT
Emulate rm -f from the nextboot.sh script: Report all errors, except
ENOENT. This problems show through, except the expected one when
nextboot.conf isn't there.

Sponsored by:		Netflix
Reviewed by:		rew
Differential Revision:	https://reviews.freebsd.org/D44013
2024-02-21 20:10:45 -07:00
Warner Losh
07cba2ddcb reboot: Emulate nextboot -D better
It used to produce no output when the file couldn't be removed. Emulate
that better by unlinking and ignoring errors. It's used at the end of
reboot always, even when the file isn't going to be there.

Sponsored by: Netflix
Fixes: 2c47954811
2024-02-20 23:04:56 -07:00
Dag-Erling Smørgrav
702f133fa1 md5: Untabify declarations.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43991
2024-02-20 23:04:45 +01:00
Dag-Erling Smørgrav
c05533d97a md5: Fix GNU check mode.
Fixes:		9b20849bc5
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43990
2024-02-20 23:04:40 +01:00
Dag-Erling Smørgrav
4db7ca2447 md5: Fix Perl mode long options.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43989
2024-02-20 23:04:36 +01:00
Dag-Erling Smørgrav
e7308a60a5 md5: Add test case for GNU input modes.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43988
2024-02-20 23:04:32 +01:00
Gleb Smirnoff
0c3ade2cf1 nextboot: fix nextboot -k on ZFS
zfsbootcfg(1) expects pool name to operate on, not currently mounted
filesystem name.

Fixes:	fd6d47375a
2024-02-19 19:51:22 -08:00
Gleb Smirnoff
3aefe67596 nextboot: fix typo that merged two args into one
Fixes:	fd6d47375a
2024-02-19 19:51:22 -08:00
Kirk McKusick
b241767f8e Eliminate unnecessary UFS1 integrity checks.
The UFS1 integrity checks added in FreeBSD 14 were too aggressive
for UFS1 filesystems created in FreeBSD 4 and 9 systems. This patch
removes those tests which can be done safely since they are not
relevant to the current implementation of UFS1.

This is a follow-on report to bug report 264450 (comments 21-28).

Reported by: slb@sonnet.com
Tested by:   slb@sonnet.com
PR:          264450
MFC after:   1 week
2024-02-19 16:17:05 -08:00
Warner Losh
2546c543fd reboot: Move extern for environ
envorin isn't defined in any header, and gcc is cranky with this inside
a function, so move it to global scope. Both clang and gcc are now happy
with this.

Sponsored by:		Netflix
2024-02-17 21:39:42 -07:00
Warner Losh
4d0be3986c reboot: Remove sys/types.h: it's not needed here... 2024-02-17 21:39:41 -07:00
Dag-Erling Smørgrav
17d5b027c1 md5: Clean up input stream rights.
Keep it simple, caph_limit_stdio() and fileargs_fopen() already take
care of everything for us.

MFC after:	1 week
Reviewed by:	markj, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D43897
2024-02-16 13:37:41 +01:00
Dag-Erling Smørgrav
5b44edb405 md5: Ignore files in string and passthrough mode.
MFC after:	1 week
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43871
2024-02-16 13:37:36 +01:00
Dag-Erling Smørgrav
72ee91fed4 md5: Accept "-" as alias for stdin.
(based on a patch by jhb)

MFC after:	1 week
PR:		276915
Reported by:	Hannes Hauswedell <h2+fbsdports@fsfe.org>
Reviewed by:	allanjude, markj, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D43870
2024-02-16 13:37:29 +01:00
Warner Losh
33a2406eed reboot: Use posix_spawn instead of system
Use posix_spawn to avoid having to allocate memory needed for the system
command line.

Sponsored by:		Netflix
Reviewed by:		jrtc27
Differential Revision:	https://reviews.freebsd.org/D43860
2024-02-15 20:59:22 -07:00
Warner Losh
e32de9626f reboot: initialize howto
Make static analyzers happy by initialzing howto to 0. Coverity is
cranky that it could be used unused. But it's analysis is incomplete
because the args to getopt when it wasn't initialized preclude it from
being used.
2024-02-15 14:32:04 -07:00
HUANG,YU-JIA
b00271ceea
growfs(8): Grammar fix
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1056
2024-02-13 17:05:18 +08:00
HUANG,YU-JIA
26c3d72eca
growfs(8): Fix spelling
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1055
2024-02-13 17:03:40 +08:00
Yi-Chen Li
d3905a3b07
dmesg(8): Fix typo timetamps -> timestamps
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1036
2024-02-13 16:42:49 +08:00
Yi-Chen Li
7a71b35023
devmatch(8): Grammar fix
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1034
2024-02-13 16:41:32 +08:00
Yi-Chen Li
e8289f82c0
comcontrol(8): Grammar fix
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1032
2024-02-13 16:40:09 +08:00
Yi-Chen Li
c407d351df
ccdconfig(8): Minor grammar fix
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1031
2024-02-13 16:38:57 +08:00
Yi-Chen Li
9977fb8042
camcontrol(8): Fix grammar: a ATA -> an ATA
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1030
2024-02-13 16:37:21 +08:00
Yi-Chen Li
31f6889564
rcorder(8): Fix grammar
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1029
2024-02-13 16:36:05 +08:00
Yi-Chen Li
b287f26c3f
setkey(8): Grammar fix: a FQDN -> an FQDN
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1024
2024-02-13 16:12:39 +08:00
Jui-Hsuan Chang
c8e7649b99
veriexec(8): Fix typo
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1018
2024-02-13 16:11:30 +08:00
Chih-Chun Wu
0a68b0066f
fdisk(8): Fix typo forth -> fourth
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1010
2024-02-13 15:17:48 +08:00
Shin-Yi Zheng
94d9c5f3be
ipf(8): Fix typo
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1002
2024-02-13 15:14:27 +08:00
Yu-Sheng Ma
c9213e4bb9
restore(8): Fix typo in restore.h
`operation` was spelled wrongly on line 60.
`dumped` was spelled wrongly on line 74.

Event:		Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/998
2024-02-13 15:07:35 +08:00
Yu-Sheng Ma
69f9c5a513
nvmecontrol(8): Fix typo in ns.c
`Insufficient` was spelled wrongly on line 537.

Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/997
2024-02-13 15:06:22 +08:00
yue0211
26e69f9f98
dump(8): Fix typo in comment
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/968
2024-02-13 12:30:30 +08:00
Hao-Yu Hou
e9866ce84f
ping(8): Fix typo in ping6.c
Line 703 & 863: kerel -> kernel
Line 2110: resposne -> response

Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/967
2024-02-13 12:29:07 +08:00
Hao-Yu Hou
2e8ad2b698
sysctl(8): Fix typo in comment
Line214: combind -> combine

Reviewed by:	zlai
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Request:	https://github.com/freebsd/freebsd-src/pull/966
2024-02-13 12:28:55 +08:00
Warner Losh
fd6d47375a rescue,nextboot: Install nextboot as a link to reboot, rm nextboot.sh
Reboot now emulates the nextboot shell script completely. Retire the
nextboot.sh script and install the link. Retain the same manual page,
since there's enough differences between nextboot and reboot that
talking about nextboot would likely be confusing in nextboot.8

The nextboot.sh script no longer exists, so doesn't need to be fixed up
to create rescue. However, now we need a link from nextboot to reboot.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43831
Differential Revision:	https://reviews.freebsd.org/D43843
2024-02-12 11:46:20 -07:00
Warner Losh
994cc83921 reboot: Allow this to be installed as nextboot
Allow nextboot to be a symlink link to reboot. It does everything reboot
does, except doesn't actually setup the sytem to reboot and reboot. Also,
don't accept the reboot args related to rebooting when in nextboot mode.

Sponsored by:		Netflix
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D43830
2024-02-12 11:46:11 -07:00
Warner Losh
91d2407702 reboot: Implement -o to set kernel options for next boot
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43829
2024-02-12 11:46:03 -07:00
Warner Losh
9dcf6cbd83 reboot: Implement -k in terms of env
kernel isn't special, beyond the sanity checks we do. Add it to the env
rather than pass it into write_nextboot().

Sponsored by:		Netflix
Reviewed by:		kevans, kib
Differential Revision:	https://reviews.freebsd.org/D43828
2024-02-12 11:45:54 -07:00
Warner Losh
ecc834241f reboot: Implement -e from nextboot
Implement -e foo=bar to add loader environment variables to
nextboot.conf. bar is enclosed in quotes if it isn't already.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43827
2024-02-12 11:45:48 -07:00
Warner Losh
0df5f65908 reboot: Implement zfs support
Implement full support for ZFS -k support. For ZFS, we have to set a
property that gets cleared by the boot loaeder for whether or not to
process nextboot.conf. Do this using system("zfsbootcfg..." rather than
coding the small subset of that program inline to avoid CDDL
contamination of reboot and the complications of disabling CDDL and/or
ZFS. The few bytes needed to implement reboot for systems with zfs is
not worth saving for systems w/o ZFS.

Only set nextboot_enable=YES for UFS filesystems. They are the only one
that need that as the first line. Its presence on ZFS can cause the
kernel to not be oneshot.

Sponsored by:		Netflix
Reviewed by:		kevans, kib
Differential Revision:	https://reviews.freebsd.org/D43824
2024-02-12 11:45:37 -07:00
Warner Losh
2c47954811 reboot: Implement -D from nextboot
Implement -D from nextboot.sh which deletes the nextboot.conf file and
exists.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43822
2024-02-12 11:45:29 -07:00
Warner Losh
cfeedadfbd reboot: Add sanity checking of write to nextboot.conf
Add sanity checking to the write to nextboot. Move to separate function
and allow force to override all errors. If we can't write nextboot.conf,
don't silently fail anymore.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D43803
2024-02-12 11:45:20 -07:00
Warner Losh
7cb1a0e6e0 reboot: Don't reboot if the next kernel isn't there
reboot -k garbage won't boot garbage unless /boot/garbage/kernel is
there. Refuse to reboot if it is missing, though allow -f to force
it for special-use cases. This is in keeping with nextboot.sh.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D43802
2024-02-12 11:45:01 -07:00
Warner Losh
7a3210f2ac reboot: convert flags to bools
Convert all the command line flags to bools, since that's how we use
them. Sort the includes while adding stdbool.h.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D43801
2024-02-12 11:44:52 -07:00
Warner Losh
a78bc42bcc reboot: Disallow -k and -r, it doesn't make sense.
When we're re-rooting to a new /, there is no next kernel. Error out
rather than leaving a timebomb in /boot/nextboot.conf.

Sponsored by:		Netflix
Reviewed by:		kevans, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D43800
2024-02-12 11:44:43 -07:00
Warner Losh
9622dc05ae zfsbootcfg: Remove bogus CFLAGS
When using the zfsbootcfg library, we're talking only to it, not to the
rest of ZFS, nor are we using anything that needs access to the ZFS
compilation environment. Remove all the compiling OpenZFS itself flags.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D43823
2024-02-12 11:44:22 -07:00
Maxim Konovalov
15cb9c0d9f ifconfig: a typo fixed in the man page
PR:	276878
2024-02-09 01:40:00 +00:00
Elyes Haouas
c1f6704bf8 ipf: Fix some typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-02-02 21:36:27 -07:00
Ricardo Branco
840a802750 umount: Add -d option to detach md devices
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/972
2024-02-02 18:35:00 -07:00
Kristof Provost
777a4702c5 pf: implement addrule via netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-02-02 17:55:16 +01:00
Ed Maste
5f047ae0c7 pflowctl: add missing break to case 's'
CID:		1534009
Reported by:	Coverity Scan
Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D43704
2024-02-01 17:03:12 -05:00
John Baldwin
c68ec278de nvmecontrol: Use NVMEF macro to construct fields
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43606
2024-01-29 11:01:46 -08:00
John Baldwin
fba73a4083 nvmecontrol: Use the NVMEV macro instead of expanded versions
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43597
2024-01-29 10:34:02 -08:00
R. Christian McDonald
5086b6ec32
libbe: handle destroying/renaming temporary/bootonce boot environments
When a temporary/bootonce boot environment is renamed, we need to also
update the bootenv nvlist on-disk to reflect the new name. Additionally,
when a temporary/bootonce boot environment is destroyed, we also need to
clear out the on-disk state.

Reviewed by:	kevans
Approved by:	kp
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43591
2024-01-29 10:07:49 -05:00
Mark Johnston
2e55256de3 route tests: Serialize
These tests reuse jail names and so cannot run in parallel.

MFC after:	1 week
2024-01-27 13:51:14 -05:00
Kristof Provost
e95025ed93 pflow: show socket status in verbose mode
Introduce a verbose output mode to pflowctl, and expose the status of
the socket to userspace. This can be helpful in debugging configuration
errors.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-25 17:37:51 +01:00
Ed Maste
54d31cfb27 mount: document atime option
atime is enabled by default, but may be specified explicitly so that any
future change in the default would not have an effect on a given mount.

Reviewed by:	olce, rgrimes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43580
2024-01-24 14:55:54 -05:00
Kristof Provost
8b82f36f89 pflowctl: fix usage message
Reported by:	Jim Pingle <jimp@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-24 20:36:32 +01:00
Ed Maste
a3ed434a69 ccdconfig: remove obsolete references to BSD disklabels
ccd(4) previoulsy had knowledge of BSD disklabels, and relied on their
use on the underlying disks, but this hasn't been the case since 2003
(commit 0f76d6d822).

Remove disklabel references from the man page.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43574
2024-01-24 12:51:45 -05:00
Igor Ostapenko
380b7eb309 sysctl.8: fix format typo
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
2024-01-23 16:40:14 +01:00
Ed Maste
3f4f82c0d7 bsdlabel: limit to 8 partitions
bsdlabel is intended to support up to 20 partitions, but the disklabel
struct has a d_partitions array with only BSD_NPARTS_MIN (8) entries.
Previously, an attempt to operate on a bsdlabel with more than eight
partitions resulted in a buffer overflow.

As a stopgap limit bsdlabel to 8 partitions until this is fixed
properly.

PR:		276517
2024-01-22 21:17:23 -05:00
Kristof Provost
484e977f24 pflow: observation domain is an unsigned integer
Ensure we print it as such, rather than as a signed integer, as that
would lead to confusion.

Reported by:	Jim Pingle <jimp@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-22 18:02:10 +01:00
Alexander Ziaee
c8bf9f09ee newfs_msdos.8: example for specific cluster size
The usual use case in 2024 for newfs_msdosfs is creating filesystems on SD cards
for older hardware. In most tutorials, they call the cluster size "allocation
size". Therefore, add a small note next to cluster size that it is also called
allocation size, and add an example for how to do this.

Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1045
2024-01-21 21:39:16 -08:00
John F. Carr
deeb1d3402 fsck_msdosfs: do not call checksize() if the cluster is bad
PR:	276464
MFC after:	1 week
2024-01-21 01:20:24 +02:00
Kristof Provost
81ea920435 pflowclt: fix gcc build error
gcc is unhappy with the nested extern declaration of __progname, so move
it out of the usage() function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-16 18:18:09 +01:00
Kristof Provost
284d31605c pflowctl.8: fix copy/paste-o
The valid values line applies to the proto field, not domain.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-16 18:18:09 +01:00
Ricardo Branco
9b20849bc5 md5: Enter capability mode earlier
Reviewed by:	markj
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/988
2024-01-16 09:38:53 -05:00
Kristof Provost
fc6e506996 pflow: add RFC8158 NAT support
Extend pflow(4) to send NAT44 Session Create and Delete events.
This applies only to IPFIX (i.e. proto version 10), and requires no
user configuration.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43114
2024-01-16 09:45:55 +01:00
Kristof Provost
85b71dcfc9 pflow: allow observation domain to be configured
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43113
2024-01-16 09:45:54 +01:00
Kristof Provost
7ec34ebe18 pfctl tests: basic pflow parser test
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43110
2024-01-16 09:45:54 +01:00
Kristof Provost
baf9b6d042 pf: allow pflow to be activated per rule
Only generate ipfix/netflow reports (through pflow) for the rules where
this is enabled. Reports can also be enabled globally through 'set
state-default pflow'.

Obtained from:	OpenBSD
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43108
2024-01-16 09:45:54 +01:00
Kristof Provost
f92d9b1aad pflow: import from OpenBSD
pflow is a pseudo device to export flow accounting data over UDP.
It's compatible with netflow version 5 and IPFIX (10).

The data is extracted from the pf state table. States are exported once
they are removed.

Reviewed by:	melifaro
Obtained from:	OpenBSD
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43106
2024-01-16 09:45:53 +01:00
Warner Losh
393f2dca36 mount: Add a note that userquota and groupquota aren't printed with -p
The quota options are pseudo options and not passed to the mount system
call when a filesystem is mounted. They are not part of the info
returned from getmntinfo(3), so can't be printed. Add a note to this
effect.
2024-01-15 21:38:26 -07:00
Mike Karels
b9e8ae1d8a route: error on IPv4 network routes with incorrect destination
Route destinations like 10/8 are most likely intended as a shorthand
for 10.0.0.0/8, but instead it means 0.0.0.10/8, which includes
only bits in the host part of the mask, and hence adds a route to
0.0.0.0/8.  In 12.x, there was code to "do what I mean", which was
removed as part of a cleanup of old network class remnants.  Given
that we have gone this long without that code, do not restore that
behavior.  Instead, detect the issue and produce an error.
Specifically, if there are no dots in a numeric IPv4 address, the
mask is specified with CIDR notation (using a slash), and there are
bits set in the host part, produce an error like this for 10/8:

    route: malformed address, bits set after mask; 10 means 0.0.0.10

PR:		258874
MFC after:	1 week
Reviewed by:	melifaro, emaste
Differential Revision:	https://reviews.freebsd.org/D43384
2024-01-15 15:14:54 -06:00
Ricardo Branco
82f2275b73 cd9660: Add support for mask,dirmask,uid,gid options
Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/982
2024-01-12 14:51:31 -08:00
Tom Hukins
ba719a0fec Fix "version introduced" in numerous manual pages
MFC after:	1 week
Pull request:	https://github.com/freebsd/freebsd-src/pull/853
2024-01-08 11:35:16 -05:00
Kristof Provost
66cacc141d libpfctl: introduce pfctl_handle
Consumers of libpfctl can (and in future, should) open a handle. This
handle is an opaque object which contains the /dev/pf file descriptor
and a netlink handle. This means that libpfctl users can open the handle
as root, then drop privileges and still access pf.

Already add the handle to pfctl_startstop() and pfctl_get_creatorids()
as these are new in main, and not present on stable branches. Other
calls will have handle-enabled alternatives implemented in subsequent
commits.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-01-04 23:10:24 +01:00
Jens Schweikhardt
359fc7eb32 Typos corrected; dependant, addres. 2024-01-04 19:17:24 +01:00
Kenneth D. Merry
cd95f18c47 camcontrol: add support for Toshiba drive firmware update
Thanks to Toshiba for providing the SCSI spec for their latest
generation drives so I could confirm how they operate.

The firmware download works in a pretty standard way, so this
is a straightforward table addition.

sbin/camcontrol/camcontrol.8:
	Document that Toshiba drives are supported for fwdownload,
	and that it was tested on TOSHIBA MG10SFA22TE 22TB drives.

sbin/camcontrol/fwdownload.c:
	Add TOSHIBA to the known SCSI vendors list for fwdownload.

Sponsored by:	Spectra Logic
MFC after:	3 days
2023-12-29 14:23:51 -05:00
Kenneth D. Merry
40a492d38e camcontrol: Add a sense subcommand
As the name suggests, this sends a SCSI REQUEST SENSE to a device,
and prints out decoded sense information.  It can also print out a
hexdump of the sense data.

sbin/camcontrol/camcontrol.c:
	Add the new sense subcommand.

sbin/camcontrol/camcontrol.8:
	Document camcontrol sense.

Sponsored by:	Spectra Logic
Reviewed by:	mav
MFC after:	3 days
Differential Revision:  https://reviews.freebsd.org/D43225
2023-12-28 16:23:16 -05:00
Elyes Haouas
540be39b0b tree: Use 1 semicolon at the end of a statement
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/889
2023-12-27 21:05:47 -07:00
Che-Yu Chang
2aa186b3b0 gvinum(8): Fix a typo
On line 354, "go up from" is mistyped as "go up form".

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/951
2023-12-26 09:12:27 -07:00
Che-Yu Chang
f8f3b16b6c camcontrol(8): Fix typos
On line 748, "bigger than" is mistyped as "bigger then", and on line
765, "more than" is mistyped as "more then".

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/949
2023-12-26 09:12:23 -07:00
Tijl Coosemans
272b4b764b devd: Don't install autofs.conf with WITHOUT_AUTOFS 2023-12-22 15:27:50 +01:00
Bjoern A. Zeeb
e85eb4c8d7 net80211: adjust more VHT structures/fields
Replace ieee80211_ie_vhtcap with ieee80211_vht_cap and
ieee80211_ie_vht_operation with ieee80211_vht_operation.
The "ie" version has the two bytes type/length at the beginning which
we did not actually use as such (the one place doing did just as unused
extra work).

Using the non-"ie" versions allows us to re-use them on shared code.
Using an enum helps us to not accidentally get unsuppored or unhandled
values tough we cannot use it in the struct as we need to ensure the
field width.

ieee80211_vht_operation is guarded by _KERNEL/WANT_NET80211.  While the
header is supposed to be exported to user land historically, software
such as wpa bring their own structure definitions.  For in-tree usage
it is only ifconfig which really cares (at least for now).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian (earlier), cc
Differential Revision: https://reviews.freebsd.org/D42901
2023-12-22 00:20:19 +00:00
Warner Losh
64db9a0f82 Add kenv .Xr in kldload(8) and loader.conf(5)
Sponsored by:		Netflix
2023-12-20 21:17:38 -07:00
Richard Scheffenegger
31cf66d755 dummynet: add simple gilbert-elliott channel model
Have a simple Gilbert-Elliott channel model in
dummynet to mimick correlated loss behavior of
realistic environments. This allows simpler testing
of burst-loss environments.

Reviewed By:           tuexen, kp, pauamma_gundo.com, #manpages
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42980
2023-12-17 13:20:45 +01:00
Warner Losh
69ae43a1e6 camcontrol: One file per line in Makefile
We have enough files now that moving to one file per line makes sense.

Sponsored by:		Netflix
2023-12-07 13:21:57 -07:00
R. Christian McDonald
ca7edd0d2c
route: introduce add interface route test cases
As a followup to D41330 and D41436, this patch introduces two new tests
for sbin/route: interface_route_v[46].

These tests fail without D41330.

Reviewed by:	kp
Approved by:	kp (mentor)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-28 16:16:25 -05:00
Mike Karels
cd201c0908 ifconfig: add -D option to print driver name for interface
Add -D option to add the drivername and unit number to ifconfig output
for normal display, including -a.  Use ifconfig_get_orig_name() from
libifconfig to fetch the name.  Note that this is the original name
for many drivers, but not for some exceptions like epair (which appends
'a' or 'b' to the unit number).  epair interface pairs both display
as "epair0", etc.  Make -v imply -D; might as well be fully verbose.

MFC after:	1 week
Reviewed by:	zlei, kp
Differential Revision:	https://reviews.freebsd.org/D42721
2023-11-28 13:47:37 -06:00
Luiz Amaral
0187875a6c pfctl: Fix recursive printing of anchor labels
We recently noticed that the recursive printing of labels wasn't working
like the recursive printing of rules.

When running pfctl -sr -a* we get a listing of all rules, including the
ones inside anchors. On the other hand, when running pfctl -sl -a*, it
would only print the labels in the root level, just like without the
-a* argument.

As in our use-case we are interested on labels only and our labels are
unique even between anchors, we didn't add indentation or hierarchy to
the printing.

Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D42728
2023-11-27 21:37:33 +01:00
Kristof Provost
47a0b59379 pfctl: use libpfctl instead of DIOCGETRULES directly
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-27 21:36:48 +01:00
Warner Losh
32e86a82f5 sbin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:23:59 -07:00
Warner Losh
0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh
5b31cc94b1 sccs: Manual changes
For the uncommon items: Go through the tree and remove sccs tags that
didn't fit any nice pattern. If in the neighborhood, other SCM tags were
removed when they were detritis of long-ago CVS somehow in the early
mists of the project. Some adjacent copyrights stringswere removed (they
duplicated the copyright notices in the file). This also removed
non-standard formations of omission of SCCS tags (usually by adding an
extra #if 0 somewhere.

After this commit, a number of strings tagged with the 'what' @(#)
prefix remain, but they are primarily copyright notices.

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh
51e16cb8fc sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:29 -07:00
Emmanuel Vadot
b3c116d50e devd: autofs: Move autofs related events to a separate file
If a user don't have FreeBSD-autofs installed there is no need to try calling
automount on every GEOM event.
It's also easier to add/delete autofs related event in a separate file.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42495
Reviewed by:	imp
2023-11-24 10:45:03 +01:00
Kirk McKusick
772430dd67 Ensure I/O buffers in libufs(3) are 128-byte aligned.
Various disk controllers require their buffers to be aligned to a
cache-line size (128 bytes). For buffers allocated in structures,
ensure that they are 128-byte aligned. Use aligned_malloc to allocate
memory to ensure that the returned memory is 128-byte aligned.

While we are here, we replace the dynamically allocated inode buffer
with a buffer allocated in the uufsd structure just as the superblock
and cylinder group buffers do.

This can be removed if/when the kernel is fixed. Because this problem
has existed on one I/O subsystem or another since the 1990's, we
are probably stuck with dealing with it forever.

The problem most recent showed up in Azure, see:
    https://reviews.freebsd.org/D41728
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267654
Before these fixes were applied, it was confirmed that the changes
in this commit also fixed the issue in Azure.

Reviewed-by: Warner Losh, kib
Tested-by:   Souradeep Chakrabarti of Microsoft (earlier version)
PR:          267654
Differential Revision: https://reviews.freebsd.org/D41724
2023-11-17 14:11:24 -08:00
Gordon Bergling
115459be31 SEE ALSO section improvements for tuning(7), tunefs(8) and fsck_ffs(8)
cross-reference ffs(7) in fsck_ffs(8)
cross-reference ffs(7) and tuning(7) in tunefs(8)
cross-reference ffs(7) in tuning(7)

PR:	263433
Reviewed by:	bcr
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D42631
2023-11-17 19:24:22 +01:00
Konstantin Belousov
a294b02fbc reboot(8): print syscall error on sysctl failure
Noted by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42561
2023-11-13 03:46:51 +02:00
Konstantin Belousov
194cc45a81 reboot(8): adapt for vmmeter v_swappgsin expansion to 64bit
Otherwise reboot(8) requires COMPAT_FREEBSD11 kernel config option.

PR:	275048
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42561
2023-11-13 03:46:36 +02:00
Luiz Amaral
81d4c78620 pfsync: Document the transport over IPv6 feature
On D40102 we implemented support for transport over IPv6 but the
documentation was not updated to reflect the new feature.

Clarify what is available and how it can be used.

MFC after:	1 week
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D42505
2023-11-10 16:40:02 +01:00
Antranig Vartanian
d6e457328d
ping6(8): Add ping6(8) as MLINK to ping(8)
Reviewed by:	chuck
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42203
2023-11-08 05:17:37 +08:00
Kristof Provost
a6173e9463 pf: expose more syncookie state information to userspace
Allow userspace to retrieve low and high water marks, as well as the
current number of half open states.

MFC after:	1 week
Sponsored by:	Modirum MDPay
2023-11-06 22:22:24 +01:00
Kristof Provost
ca9dbde881 pf: support SCTP-specific timeouts
Allow SCTP state timeouts to be configured independently from TCP state
timeouts.

Reviewed by:	tuexen
MFC after:	1 week
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D42393
2023-10-31 16:03:22 +01:00
Konstantin Belousov
224fc33f60 setkey(8): make the policy specification more readable
by applying markup and highlighting the semantical blocks.

Sponsored by:	NVidia networking
MFC after:	1 week
2023-10-31 06:07:10 +02:00
Stephen J. Kiernan
5e3190f700 dirdeps: Update Makefile.depend* files with empty contents
Some Makefile.depend* files were committed with no contents or empty
DIRDEPS list, but they should have DIRDEPS with some contents.
2023-10-29 17:01:04 -04:00
Warner Losh
aa7c028adb devd: Improve devmatch support
We know that calling devmatch will be futile if there's no plug and play
information for it to match on. Avoid this generically when we see
	"? at +on"
which happens only when the location and pnpinfo aren't provided. Don't
call "service devmatch quietstart" here.

We also ignore ACPI devices with a _HID of none. These also will never
load a new driver, so avoid calling "service devmatch quietstart" here too.

Use the more compatct "$*" instead of "'?'$_" when calling "service
devmatch quietstart" since it will evaluate to the same thing.

On my laptop, this eliminates 45% of the calls to devmatch. While it
would be even better to integrate devmatch into devd (so we only parse
linker.hints once), that will have to wait for another day as it's a bit
more complex to arrange that avoiding easy to avoid calls.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D42326
2023-10-27 15:24:19 -06:00
Warner Losh
dbf203548b devd: Remove obsolete / wrong nomatch examples
These examples are wrong, and with devmatch, nobody would ever see them
(since it's a higher priority).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42325
2023-10-27 15:24:19 -06:00
Warner Losh
5e50df6dc0 devd: Restore WARNS=6
We compile correctly on all platforms with clang and WARNS=6. We build
on amd64 with gcc12 and WARNS.6. Restore WARNS=6. This reverts
3741a56c31, since that's no longer relevant.

Sponsored by:		Netflix
2023-10-26 10:11:59 -06:00
Kirk McKusick
d3a36e4b74 Delete snapshot after opening it when running fsck_ffs(9) in background.
When fsck_ffs(8) runs in background, it creates a snapshot named
fsck_snapshot in the filesystem's .snap directory. The fsck_snapshot
file was removed when the background fsck finished. If the system
crashed or the fsck exited unexpectedly, the fsck_snapshot file
would remain. The snapshot would consume ever more space as the
filesystem changed over time until it was removed by a system
administrator or a future run of background fsck removed it to
create a new snapshot file.

This commit unlinks the .snap/fsck_snapshot file immediately after
opening it so that it will be reclaimed when fsck closes it at the
conclusion of its run. After a system crash, it will be removed as
part of the filesystem cleanup because of its zero reference count.
As only a few milliseconds pass between its creation and unlinking,
there is far less opportunity for it to be accidentally left behind.

PR:           106107
MFC-after:    1 week
2023-10-25 15:38:11 -07:00
Jose Luis Duran
0514f032c8 devfs(8): Remove references to /usr/share/examples/etc/devfs.conf
This file does not exist, remove it from the list of files to avoid
confusion.  The example file is just /etc/devfs.conf.

Reviewed by:	mhorne
Pull Request:	https://github.com/freebsd/freebsd-src/pull/871
2023-10-23 15:14:23 -03:00
Kristof Provost
4f33755051 pf: allow states to be killed by their pre-NAT address
If a connection is NAT-ed we could previously only terminate it by its
ID or the post-NAT IP address. Allow users to specify they want look for
the state by its pre-NAT address. Usage: `pfctl -k nat -k <address>`.

See also:	https://redmine.pfsense.org/issues/11556
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42312
2023-10-23 16:37:05 +02:00
Kristof Provost
044eef6ab9 pf: support basic filters for state listing
Allow users(pace) to specify a protocol, interface, address family and/
or address and mask, allowing the state listing to be pre-filtered in
the kernel.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42280
2023-10-23 16:24:52 +02:00
Kirk McKusick
1e39a0886e Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Add missing check for failed block read when checking information about
a snapshot file.

Reported-by:  Andreas Bock
PR:           274404
MFC-after:    1 week
2023-10-20 15:15:40 -07:00
Jose Luis Duran
24fe0cb84d ping tests: Fix test on i386 platforms
Actually use INT_MAX (0x7fffffff), not UINT_MAX (0xffffffff) to avoid
overflowing time_t and missing the test.

Reported by:	Jenkins
Reviewed by:	markj
Fixes:		5b8af90fe3 ("ping: Add ATF-Python tests")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/874
Differential Revision: https://reviews.freebsd.org/D42268
2023-10-19 09:35:39 -04:00
Kristof Provost
4f8f43b06e netlink: cope with growing requests
If a request ends up growing beyong the initially allocated space the
netlink functions (such as snl_add_msg_attr_u32()) will allocate a
new buffer. This invalidates the header pointer we can have received
from snl_create_msg_request(). Always use the hdr returned by
snl_finalize_msg().

Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42223
2023-10-17 08:47:52 +02:00
Kajetan Staszkiewicz
18be782c4e pfsync: Provide documentation regarding message version
Reviewed by:	kp
MFC after:	3 days
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D42235
2023-10-17 06:38:47 +02:00
Kristof Provost
6ace92326f ifconfig: add static bridge addresses for vlan 0, not 1
Since fd7edfcdc3 ("bridge: fix lookup for untagged packets in
bridge_transmit()") and b0e38a1373 ("bridge: distinguish no vlan and
vlan 1") we do a better job of distinguishing between untagged and VLAN
1 traffic.

However, ifconfig still defaulted to adding addresses for VLAN 1, rather
than for untagged traffic. Change this to be the most common (i.e.
untagged) option.

Reviewed by:	zlei, philip
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42188
2023-10-15 16:21:53 +02:00
Kristof Provost
81647eb60e pf: implement start/stop calls via netlink
Implement equivalents to DIOCSTART and DIOCSTOP in netlink. Provide a
libpfctl implementation and add a basic test case, mostly to verify that
we still return the same errors as before the conversion

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42145
2023-10-13 09:53:22 +02:00
Dag-Erling Smørgrav
fc7143b483 ping: Add missing ATF boilerplate.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42161
2023-10-11 21:45:06 +02:00
Dag-Erling Smørgrav
c4ffb80ef1 ping: Consistently use EX_NOHOST for DNS failures.
Traditionally, ping returned exit code EX_NOHOST if a DNS lookup failed.
That is still the case for the legacy code in the new merged ping, but
not for IPv6 targets, nor when a DNS lookup is performed in order to
determine which version of the tool to invoke.

While here, also make sure that the error message is consistent.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42159
2023-10-11 21:44:30 +02:00
Jose Luis Duran
4efaf43c6f ping: Require root user for pytests
atf_python may use vnet jails for creating an isolated test environment.
Mark these tests that require root user privileges.

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
2023-10-11 13:48:28 -04:00
Jose Luis Duran
b86e4812cc ping: pr_iph() improvements
Very early on, the Src/Dst IP addresses were printed in hex notation
(%08x), which will always be 8-characters wide.  It was later changed to
use a dot-decimal notation.  Depending on the IP address length, the Src
and Dst headers may require a different padding.  Use the source and
destination IP lengths as padding for the headers.

Also, print an Opts (options) header, if there are options present.  It
has been abbreviated to Opts to match the length of the previous Data
header, removed in ef9e6dc7ee.

Print the header info such that no trailing spaces are produced.  As
some git workflows may automatically trim them, and make the tests fail
(see 25b86f8559).

Before

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2␣

After

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2

And with options:

Before

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2 01...

After

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst Opts
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2 01...

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D39561
2023-10-11 13:48:28 -04:00
Jose Luis Duran
8db2c5802a ping: Fix the spacing between the time stamp and cp/dp
When an echo reply packet is received, the data is compared with the
sent data.  When a wrong byte is detected the command displays a report
with the differences.

The first row (the first 8-bytes of data after the ICMP header) should
include the time stamp (if data is at least 8-bytes), this value is not
taken into consideration for the comparison.  The remaining rows
represent the data (padded pattern) received/sent, with each byte being
compared for differences.

Print the space before (not after), to add an extra space after cp:/dp:
for better readability when the first time stamp octet is not
zero-padded, and to remove trailing spaces in the output.

Before:
    cp:99  0  0  c  1  5  c  0␣
    	ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd␣
    	...

After:
    cp: 99  0  0  c  1  5  c  0
    	 ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd
    	 ...

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D39492
2023-10-11 13:48:28 -04:00
Jose Luis Duran
03d4d1c778 ping: Unify ping/ping6 statistics section
This is a first step towards a unification/simplification of ping/ping6
(internally).  The end goal is to produce a standardized user-facing
output.

Before (ping6):

    PING6(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
    16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
    16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

    --- 2001:db8::2 ping6 statistics ---
    round-trip min/avg/max/std-dev = 0.068/0.118/0.168/0.050 ms

After (ping6):

    PING(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
    16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
    16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

    --- 2001:db8::2 ping statistics ---
    round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

This has the nice side-effect of adding units to SIGINFO's statistics,
as printing numbers without units may not be of much help.  Also
mentions the fact that these times are round-trip.

Before (ping/ping6 SIGINFO):

    2/2 packets received (100.0%) 0.068 min / 0.118 avg / 0.168 max

After (ping/ping6 SIGINFO):

    --- <ipv4/ipv6 address> ping statistics ---
    2 packets transmitted, 2 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

In the case of a SIGINFO, the output will be printed to stderr, for both
ping and ping6.

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D39126
2023-10-11 13:48:28 -04:00
Jose Luis Duran
72d3e6677f ping: Specify the sigaction(2) name
After a2a0088805, specify the signal name.

Obtained from:	Darwin
MFC after:	1 week
Reviewed by:	asomers
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D38484
2023-10-11 13:48:28 -04:00
Jose Luis Duran
d2c9a14054 ping: Remove an extra new line character
This matches the behavior when an RR truncated route is printed.

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D39485
2023-10-11 13:48:27 -04:00
Jose Luis Duran
20012a3a1a ping tests: Test IHL/quoted data/inner packet paths
Commit 46d7b45a26 introduced these code
paths.  Test and document them.

- Add inner packet too short test
- Add inner IHL too short test
- Add quoted data too short test
- Add IHL too short test
- Add max inner packet IHL without payload test

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D38528
2023-10-11 13:48:27 -04:00
Jose Luis Duran
4d348e83b7 ping: Avoid reporting NaNs
Avoid calculating the square root of negative zero, which can easily
happen on certain architectures when calculating the population standard
deviation with a sample size of one, e.g., 0.01 - (0.1 * 0.1) =
-0.000000.

Avoid returning a NaN by capping the minimum possible variance value to
zero (positive).

In the future, maybe skip reporting statistics at all for a single
sample.

Reported by:	Jenkins
Reviewed by:	asomers
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D42114
2023-10-11 13:48:27 -04:00
Dag-Erling Smørgrav
7fd2c91a29 ping: Simplify protocol selection.
* Interrupt the option loop as soon as we have an indication of which
  protocol is intended.
* If we end up having to perform a DNS lookup, loop over the entire
  result looking for either IPv4 or IPv6 addresses.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	rscheff, kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D42137
2023-10-11 00:47:59 +02:00
Kristof Provost
a7191e5d7b pf: add a way to list creator ids
Allow userspace to retrieve a list of distinct creator ids for the
current states.

This is used by pfSense, and used to require dumping all states to
userspace. It's rather inefficient to export a (potentially extremely
large) state table to obtain a handful (typically 2) of 32-bit integers.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42092
2023-10-10 11:48:21 +02:00
Kristof Provost
f218b851da libpfctl: introduce state iterator
Allow consumers to start processing states as the kernel supplies them,
rather than having to build a full list and only then start processing.
Especially for very large state tables this can significantly reduce
memory use.

Without this change when retrieving 1M states time -l reports:

    real 3.55
    user 1.95
    sys 1.05
        318832  maximum resident set size
           194  average shared memory size
            15  average unshared data size
           127  average unshared stack size
         79041  page reclaims
             0  page faults
             0  swaps
             0  block input operations
             0  block output operations
         15096  messages sent
        250001  messages received
             0  signals received
            22  voluntary context switches
            34  involuntary context switches

With it it reported:

    real 3.32
    user 1.88
    sys 0.86
          3220  maximum resident set size
           195  average shared memory size
            11  average unshared data size
           128  average unshared stack size
           260  page reclaims
             0  page faults
             0  swaps
             0  block input operations
             0  block output operations
         15096  messages sent
        250001  messages received
             0  signals received
            21  voluntary context switches
            31  involuntary context switches

Reviewed by:	mjg
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42091
2023-10-10 11:48:21 +02:00