Commit graph

21116 commits

Author SHA1 Message Date
Kristof Provost
08d0120417 snmp_pf: fix rules->label use
We now support multiple lables on a rule, so 'rule' is an array of strings, not
just one string. Adjust the check for 'is there a label?'.

CID:		1471808
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-21 09:49:06 +01:00
Kristof Provost
207f938bc5 snmp_pf: address Coverity remarks about time_t
On most platforms time_t is 64 bits wide, but we assign it to 32 bits
variables. Unfortunately these are SNMP fields that are defined to be 32 bits
wide, so we cannot change this. We are similarly unable to prevent the passage
of time, meaning that time_t must remain 64 bits wide as well.

Explicitly cast to tell Coverity that we're aware of these limitations and do
not wish to be reminded of them.

CID:		1553869
CID:		1557025
CID:		1592232
CID:		1592234
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-21 09:25:57 +01:00
Bjoern A. Zeeb
045a4c108f wlanstats: add -Wno-cast-align back for now
After fixing the obvious build and cast error when moving this from tools
to usr.sbin and removing -Wno-cast-align, re-add it back as at least
powerpc* does not compile without it (amd64, arm64, and i386 were ok).

In general wlanstats may now get a bit more love after 22 years of
being in the tree and being moved at least twice.
But first unbreak things again.

Reported by:	mmel, cperciva (weekly snapshots)
Sponsored by:	The FreeBSD Foundation
Fixes:		61ce422531
MFC after:	3 days
2025-02-20 21:53:09 +00:00
John Baldwin
8206fcc5ef ctladm: portlist -i lists target and initiator names rather than addresses
Sponsored by:	Chelsio Communications
2025-02-20 10:39:50 -05:00
John Baldwin
b277346d24 ctladm: Handle connected hosts for NVMeoF ports
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48776
2025-02-20 10:31:21 -05:00
Bjoern A. Zeeb
61ce422531 wlanstats: move from tools to usr.sbin
wlanstats is an incredible tool to get a quick overview of state
of affairs of wireless by looking at the counters.
And it makes it simple.

Having landed the LinuxKPI HW_CRYPTO bits I was asked by users
what to check and I realised the answer is in wlanstats.

It is annoying even as a developer to manually build it for each
installation but given it's also useful to users and support
make it available with the general installation.
Probably very long overdue.

Adjust the Makefile and make build again on main.
Hook it up to the build conditional on MK_WIRELESS.

Discussed with:	adrian
Sponsored by:	The FreeBSD Foundation
TODO:		man page
MFC after:	3 days
2025-02-19 02:56:59 +00:00
Mark Johnston
649a910e34 bhyve: Avoid holding /dev/pci open unnecessarily
Some device models, LPC in particular, will call pci_host_read_config()
when probing for devices.  Currently this results in pcifd_init()
opening /dev/pci, and thus bhyve holds the fd open even when it's not
needed.

Modify pci_host_{read,write}_config() to open /dev/pci independent of
the global pcifd.  This means that these routines can only be used
during VM initialization, as capsicum will prevent further opens
afterward.  Introduce internal wrappers which use the global pcifd,
intended for the passthru code.

Reviewed by:	jhb
MFC after:	3 weeks
Fixes:		563fd2240e ("bhyve: export funcs for read/write pci config")
Differential Revision:	https://reviews.freebsd.org/D48908
2025-02-14 15:25:08 +00:00
Jamie Gritton
3d11af1e59 jls: fix the -q option to put quotes around all whitespace
PR:		283414
2025-02-13 07:48:18 -08:00
Jamie Gritton
b144e883ca jls: admit that jail parameters with newlines print multiple lines
PR:		283414
Reported by:	dch
2025-02-13 07:47:12 -08:00
John Baldwin
5e6a462277 ctld: Fix parsing of text values for DSCP in UCL parser
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48933
2025-02-12 14:27:53 -05:00
John Baldwin
79a4240b13 ctld: Use preferred style for evaluating result of strcmp
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48932
2025-02-12 14:27:30 -05:00
John Baldwin
f42f7bedab ctld: Fail for missing or invalid CHAP secrets in UCL config
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48931
2025-02-12 14:27:06 -05:00
John Baldwin
64905b38b1 ctld: Fix the isns-period and isns-timeout keywords in the UCL parser
These keywords were setting the wrong configuration value (connection
timeout).

Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48930
2025-02-12 14:26:43 -05:00
John Baldwin
6de7a0d6c4 ctld: Consistently free temporary strings during yacc parsing
The lexer always allocates a duplicate string via strdup for STR
tokens.  The parse handlers did not always free these duplicated
strings after consuming them.

Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48929
2025-02-12 14:26:16 -05:00
John Baldwin
450a84c292 ctld: Some bool-related cleanups
- Convert a few variables from int to bool

- Return bool instead of inverted 0/1 from configuration parsing
  functions and the auth check functions

- Invert the existing dont_daemonize bool into a daemonize boolx

Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48928
2025-02-12 14:25:52 -05:00
John Baldwin
ca8a23d6cb ctld: Drop some #if 0'd debugging traces
Suggested by:	asomers
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48927
2025-02-12 14:25:22 -05:00
Jose Luis Duran
8d9c25c4e1
syslogd: Fix tests when if_epair is not loaded
Take a cue from vnet.subr and abstract module loading, jail creation and
cleanup.

Note that the way jails are created differs slightly from vnet.subr, to
maintain the current style of the tests.

Reported by:	Jenkins
Reviewed by:	markj
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48949
2025-02-12 14:42:09 +00:00
Minsoo Choo
ca4eddea97 src: Use gnu17 as the default C standard for userland instead of gnu99
Tracking newer versions of C (and C++) permits assuming newer language
features in the base system.  Some C11 extensions are already used in
the base system but implemented on top of GNU C extensions such as
_Alignas and _Static_assert.  In some cases the fallback versions in
cdefs.h are more limited than the native C11 extensions.

Even though C11 is the next major version of C, C17 is chosen instead
since C17 does not add new features to C but merely fixes defects in
C11.  It is also well supported by a wide range of clang (7.0.0+) and
GCC (8.1+) versions.

Along with changing the default, this change also removes explicit
requests for c11 via the CSTD variable in various Makefiles.

Libraries and binaries for ZFS continue to use c99.

PR:		284039 (exp-run)
Reviewed by:	imp, arichardson, emaste
Differential Revision:	https://reviews.freebsd.org/D43237
2025-02-11 09:16:25 -05:00
Bryan Drewery
2f17efa0d7 config(5): Fix display of includeoptions 2025-02-10 21:05:26 -08:00
John Baldwin
4dfc2553c3 ctladm: Use nvlist instead of home-rolled name-value lists
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48774
2025-02-05 14:55:16 -05:00
John Baldwin
9e425a8a7e ctld: Move kernel_limits into login.c where it is used
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48771
2025-02-05 14:55:16 -05:00
John Baldwin
0a3e74f55a ctld: Don't specify the TCP port for default iSCSI portal group sockets
portal_group_add_listen already uses the default TCP port if no port
is specified so this was redundant.

Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48770
2025-02-05 14:55:16 -05:00
John Baldwin
aa06023270 ctld: Factor out functions to parse dscp and pcp properties
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48769
2025-02-05 14:55:16 -05:00
John Baldwin
7bad3c3e5f ctld: Write the pidfile once after forking
Don't rewrite the pidfile each time main_loop is called.

PR:		284282
Reported by:	asomers
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48768
2025-02-05 14:55:16 -05:00
Ruslan Bukin
48f91cacc3 bhyve/riscv: clean up SBI handlers.
Similar to kernel SBI clean up patch, do clean up in userspace SBI part:

- use standard SBI error codes;
- remove unused function.

Differential Revision:	https://reviews.freebsd.org/D48829
2025-02-05 09:32:25 +00:00
Ruslan Bukin
6492ef7b83 bhyve: Sleep for a short period after VM_EXITCODE_DEBUG exits
Apply 2e2b8afa52 for RISC-V:

As on amd64 and aarch64 APs will repeatedly exit until they are
brought online, so this hack helps avoid burning CPU time during
guest bootup.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D48811
2025-02-05 09:30:58 +00:00
Ruslan Bukin
d69ab49ce0 bhyve/riscv: fix HSM extension handling.
Pass private data from supervisor as the second argument on secondary
CPU startup.

This is used by Linux guest.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48807
2025-02-05 09:24:35 +00:00
Enji Cooper
d90e14fc18 mptutil: Capture CAM errors from bus rescan
This will force reporting of CAM errors from rescanning the bus.

PR: 174072
Reviewed by: imp
2025-02-04 20:54:26 -07:00
Olivier Cochard
f16ca171ea man: Remove references to classful networks
Update wording in manual pages to replace references to classful networks with
CIDR notation.

Approved by:	glebius, dhw
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D48853
2025-02-04 22:27:21 +01:00
Jessica Clarke
97350075fe bsdinstall: Switched back to amended single-button finalconfig
Commit ac78e3e9c5 ("bsdinstall: Add "Finish" button to finalconfig")
removed the Exit entry from the menu, renamed OK to Select and added a
Finish in place of the old Exit entry. On the surface this seemed like a
good idea, as at a glance OK wasn't clear that it was selecting an entry
rather than just closing the box, Exit isn't the most obvious term
to use for proceeding through the installer without doing anything, and
it separated out the different cases of "do something extra" and
"continue". However, because bsddialog (and dialog) keep a menu entry
highlighted even when the Cancel (in this case, Finish) button is
selected, this now looks even more confusing, with users easily
believing that they are about to select the Add User option (being
either surprised when it doesn't actually do that, or being confused
about how to not select it).

Instead, go back to the old scheme that fits more with bsddialog's
supported functionality but tweak it to try and improve on the confusing
UI/UX from the past. Specifically, the UI changes compared with the
original version are as follows:

1. The OK button is renamed to Select, as in the current UI
2. The Exit entry is renamed to Finish, mirroring the label of the
   button in the current UI that it replaces

This partially reverts commit ac78e3e9c5.

Reviewed by:	khorben_defora.org
Differential Revision:	https://reviews.freebsd.org/D47229
2025-02-04 17:27:00 +00:00
Ed Maste
ecccb638d4 mountd: Promote missing netmask log to LOG_ERR
Historical network classes are deprecated, but currently still supported
in mountd with a LOG_WARNING-priority message added by Mike Karels in
2021.  Upgrade the log to LOG_ERR well in advance of this becoming a
fatal error.

Reviewed by:	rmacklem
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48795
2025-02-04 11:58:41 -05:00
Alexander Ziaee
8b35839346
gstat: Sync usage/synopsis + tag SPDX
Sort options using the slightly unusual convention used here as well.

MFC after:		3 days
Approved by:		carlavilla (mentor), imp (src)
Differential Revision:	https://reviews.freebsd.org/D48800
2025-02-03 10:06:59 -05:00
Ruslan Bukin
7ac65902d8 bhyve/riscv: fix interrupts-extended property.
Construct interrupts-extended (property of APLIC) properly.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48713
2025-02-03 11:44:18 +00:00
Ruslan Bukin
6b599b34df bhyve/riscv: remove clock-frequency from CPU node.
Remove CPU clock-frequency property as incorrectly constructed
and not needed.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48712
2025-02-03 11:42:50 +00:00
Ruslan Bukin
95b8b67f3c bhyve/riscv: add clock-frequency property to DTS.
Add clock-frequency property to the UART adapter node in DTS.

Differential Revision:	https://reviews.freebsd.org/D48699
2025-02-03 11:39:21 +00:00
Gleb Smirnoff
765ad4f039 rpcsec_tls: cleanup the rpctls_syscall()
With all the recent changes we don't need extra argument that specifies
what exactly the syscalls does, neither we need a copyout-able pointer,
just a pointer sized integer.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48649
2025-02-01 01:00:28 -08:00
Gleb Smirnoff
8e5f80da89 rpc.tlsservd: provide parallelism with help of pthread(3)
At normal NFS server runtime there is not much RPC traffic from kernel to
rpc.tlsservd.  But as Rick rmacklem@ explained, the notion of multiple
workers exists to handle a situation when a server reboots and it has
several hundred or thousands of TLS/TCP connections from clients.  Once it
comes back up, all the clients make TCP connections and do TLS handshakes.

So cleanup the remnants of the workers, that left after the conversion of
RPC over netlink(4) transport and restore desired parallelism with help of
pthread(3).

We are processing the TLS handshakes in separate threads, one per
handshake.  Number of concurrent threads is capped by hw.ncpu / 2, but this
can be overriden with -N.

Differential Revision:	https://reviews.freebsd.org/D48570
2025-02-01 01:00:28 -08:00
Gleb Smirnoff
550e8e306a rpc.tlsservd/rpc.tlsclntd: rename 'refno' field to 'cookie'
Since in the kernel and in the API this is now called socket cookie.
No functional change.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48777
2025-02-01 01:00:27 -08:00
Gleb Smirnoff
4df8df92d4 rpc.tlsservd: followup of API refactoring in the previous commit
Userland counterpart of the previous commit.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48567
2025-02-01 01:00:27 -08:00
Gleb Smirnoff
e1b723d5fe rpc.tlsclntd: followup of API refactoring in the previous commit
Userland counterpart of the previous commit.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48565
2025-02-01 01:00:27 -08:00
Gleb Smirnoff
d3d6c9b615 rpc.tlsservd: run netlink(4) service and use new API to get sockets
Userland counterpart of the previous commit.

Note: this change intentionally ignores aspect of multiple workers of
rpc.tlsservd(8).  This also will be addressed in a future commit.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48562
2025-02-01 01:00:27 -08:00
Gleb Smirnoff
88b0afe64c rpc.tlsclntd: run netlink(4) service and use new API to get sockets
Userland counterpart of the previous commit.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48560
2025-02-01 01:00:26 -08:00
Gleb Smirnoff
d50fc4ba54 rpcbind: run netlink(4) service
To register RPC bindings coming from the kernel.  At the moment, we expect
such bindings only from the kernel NLM service.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48556
2025-02-01 01:00:26 -08:00
Gleb Smirnoff
a8f61691e9 gssd: use netlink(4) RPC service to talk to kernel GSS
Userland counterpart of the previous commit.

Reviewed by:		rmacklem
Differential Revision:	https://reviews.freebsd.org/D48553
2025-02-01 01:00:26 -08:00
John Baldwin
66b107e82b ctld: Use kevent(2) for socket events rather than select(2)
Reviewed by:	asomers
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48597
2025-01-30 10:48:44 -05:00
John Baldwin
703b03a8e3 ctld: Use nvlist instead of home-rolled name-value lists
Reviewed by:	asomers (older version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48595
2025-01-30 10:19:51 -05:00
Eygene Ryabinkin
0feaf865ce iwmbtfw(8): fix getopt flags, unify usage()/manual page contents
Seems like there was an intention to use command line switches
-m, -p and -v (each with argument), but there is no handling
for them.

Also, some enhancements to the usage()/manpage:

 - use FreeBSD manpage style -- square brackets -- for denoting
   optional arguments in usage();

 - show default directory path in usage();

 - update manual: -f is the optional flag;

 - show descriptions for -I/-D together: they are logically related.

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month
2025-01-30 00:56:41 +03:00
Eygene Ryabinkin
ff4116313e iwmbtfw(8): don't program hardware without existing firmware image
One should not start firmware update sequence just to understand
that there is no firmware image to program: update sequence for 7260
requires leaving manufacturing mode and in the case of missing
firmware file it will trigger complete re-initialization of BT adapter.
Which, in turn, will make the USB device to go away and reappear.

Since devd(8) has hooks for USB device attachment, in the case
of missing firmware it used to
 - trigger the (failing) firmware download,
 - which triggers device reset,
 - which creates USB notification and devd(8) kicks back in.

Nice infinite cycle with many notifications via syslog:
{{{
Jan  3 09:00:01 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0
Jan  3 09:00:01 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0 (disconnected)
Jan  3 09:00:02 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0
Jan  3 09:00:02 kernel: ugen0.2: <vendor 0x8087 product 0x0a2a> at usbus0 (disconnected)
}}}

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month
2025-01-30 00:56:41 +03:00
Eygene Ryabinkin
06969db312 Refactor iwmbtfw: modularize and de-constify
- Move logic for firmware download into different adapter types
   to the own functions to allow main() to be simpler

 - Use enums/typedefs for exit modes, image types, etc

 - Purge most obvious comments: functions are named properly,
   so most of their invocations self-document the code.

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month
2025-01-30 00:56:40 +03:00
Eygene Ryabinkin
f466ba4ca4 Refactor iwmbtfw: set default firmware_dir after argument parsing
Don't repeat firmware_dir stanza at all "if" branches: be more DRY.

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month
2025-01-30 00:56:40 +03:00