Commit Graph

20765 Commits

Author SHA1 Message Date
Alan Somers
2909ddd17c ctld: plug memory leaks
MFC after:	2 weeks
Reviewed by:	mav
Sponsored by:	Axcient
Reported by:	valgrind
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1288
2024-06-14 12:08:38 -06:00
Ed Maste
aa6fb1d277 tzsetup: ask local/UTC question only on x86
Storing local time in the RTC is a legacy of 1990s PCs; it's not
relevant on other platforms of interest to FreeBSD.

While here switch to C99 bool.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	allanjude (earlier), imp (earlier)
Differential Revision: https://reviews.freebsd.org/D45575
2024-06-14 12:15:48 -04:00
Ed Maste
70e3e1bde9 tzsetup: add detail for -s option
Skipping the UTC question via -s will not create or delete
/etc/wall_cmos_clock.

Reported by:	Tomoaki AOKI
Reviewed by:	imp, allanjude, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45576
2024-06-14 10:02:31 -04:00
Ed Maste
a16cb8709d tzsetup: Correct UTC description
UTC is Coordinated Universal Time, not Greenwich Mean Time.

Reviewed by:	imp, allanjude
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45573
2024-06-12 20:24:49 -04:00
Andrew Turner
9a4813e1dc bhyve: Fix the build with gcc
gcc doesn't like const and static to not be at the start of a variable
declaration. Update the gdb_regset arrays to make it more obvious they
are arrays of struct gdb_reg and to fix the gcc build.

Reviewed by:	corvink, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45550
2024-06-11 13:12:43 +00:00
Alan Somers
edbd489d09 ctladm: don't require the use of "-p" with "port -r"
When removing a port, the ioctl frontend requires the "-p" argument.
But other frontends, like cfiscsi, do not.  So don't require that
argument in the ctladm command.  The frontend driver will report an
error if any required argument is missing.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1279
2024-06-10 10:01:25 -06:00
Alan Somers
afecc74cd7 ctladm: better documentation for adding and removing cfiscsi ports
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1279
2024-06-10 10:01:25 -06:00
Alan Somers
591de7534f ctladm: print port number with a succesful "port -c" command
Make "ctladm port -c" print the port number of the newly successful
port.  This way it won't have to be guessed by a subsequent "ctladm
portlist" command.  That means it's safe to use it concurrently with
other ctladm processes.  In particular, this allows the tests to be run
in parallel.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1279
2024-06-10 10:01:25 -06:00
Alan Somers
9747d11d91 Add some ATF tests for ctladm
So far only "ctladm port -c" and "ctladm port -r" are covered.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	mav
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1279
2024-06-10 10:01:25 -06:00
Kristof Provost
d9ab899931 pf: migrate DIOCGETLIMIT/DIOCSETLIMIT to netlink
Event:		Kitchener-Waterloo Hackathon 202406
2024-06-07 20:59:02 +02:00
Warner Losh
c0c066f86d config: Remove redundant code
since errx is marked dead2, we don't need this.

Noticed by:		jrtc27
Sponsored by:		Netflix
2024-06-06 15:48:38 -06:00
Alan Somers
60107d23d8 ctladm.8: fix several errors in the "port" section
* Document the "-d" option.
* Add the "-c" and "-r" options to the summary.
* Correct the list of required options.
* Clarify that the "-t" option is only for use with "-o", "-w", and "-W"
* Replace references to the nonexistent "-n" with "-p".

Also, fix a few related error strings in the ctladm command.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D45503
2024-06-06 11:22:06 -06:00
Mark Johnston
05704402ac bhyve: Add a stub VM_EXITCODE_REG_EMUL handler
This lets us print a few fields of interest before aborting the VM loop.

No functional change intended.

Reviewed by:	corvink, andrew
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44741
2024-06-04 15:06:42 -04:00
Mark Johnston
a0ca4af945 bhyve: Add arm64 support to the gdb stub
- Add -G to the arm64 getopt handler.
- Add static register definitions and extensible XML definitions.
- Provide definitions for MD bits such as breakpoint encoding and
  length.
- Ensure that bhyve re-injects breakpoint exceptions that it is not
  responsible for.

Reviewed by:	andrew
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44740
2024-06-04 15:03:17 -04:00
Corvin Köhne
e425e601b9
bhyve: verify OpRegion size
If the OpRegion size doesn't match the size of our igd_opregion struct, it's
using a different layout than we're expecting. To avoid strange issues, we
should exit hard. If we see any devices in the field with a different OpRegion
size, we can analyse it and fix it accordingly.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D45335
2024-06-04 09:08:49 +02:00
Corvin Köhne
5e09c5a1ed
bhyve: use correct size to map the OpRegion
We're already converting the size reported by the OpRegion header from
kilobytes to bytes. We don't have to do that twice when mapping the OpRegion.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D45334
2024-06-04 09:08:34 +02:00
Dapeng Gao
fbfdf57d65 Fix off-by-one bug in btpand
`ul` reaches `__arraycount(services)` before the bound-check happens, causing undefined behaviour.

Reviewed by:	imp, jrtc27
Fixes:		7718ced0ea ("Add btpand(8) daemon from NetBSD.")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45463
2024-06-03 20:30:36 +01:00
Dapeng Gao
5dda778db6 Use correct function declaration for yyerror
According to the POSIX standard at
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
`yyerror` should return `int`. Add unreachable since errx never returns.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D45447
2024-06-03 12:14:10 -06:00
Mark Johnston
be2f92a96b makefs/zfs: Add a helper function for adding ZAP entries
Some ZAPs are used to represent sets, in which keys and values are the
same.  Add a helper function for this case.  No functional change
intended.

MFC after:	1 week
2024-06-01 11:16:18 -04:00
Alexander Ziaee
9c0d6df100 man bluetooth/fwdownloaders: alignment nits, SPDX
MFC after: 3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1267
2024-05-31 14:26:09 -06:00
Konstantin Belousov
1eb7099eac acpidump: improve length calculation for several IVHD elements
Use sizeofs of structures corresponding to the parsed device entry.
This does not change the calculation, but fixes logical inconsistency.

Sponsored by:	The FreeBSD Foundation
Sponsored by:	Advanced Micro Devices (AMD)
MFC after:	1 week
2024-05-31 22:10:39 +03:00
Alexander Ziaee
2c901189bb man bluetooth/fwdownloaders: terse descriptions
+ descriptions no longer wrap on a standard console, no keywords removed
+ more consistent language with other firmware tooling manuals

MFC after: 3 days
Reviewed by: imp (bumped date for Nd changes)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1266
2024-05-31 11:40:44 -06:00
Mike Karels
d2f1f71ec8 pw userdel: destroy home dataset if empty
When removing a user's home directory, if the directory is a ZFS
dataset, it cannot be removed.  If the directory has been emptied,
use "zfs destroy" to destroy it.  This complements the automatic
dataset creation in adduser.  Note that datasets within the directory
and snapshots are not handled, as the complete path is not constructed.

While here, add waitpid() calls to rmat() and pw_user_del().

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45348
2024-05-29 18:55:14 -05:00
Pierre Pronchery
19dbf72a27 bhyve: correctly remove a memory mapping
In a normal code path while setting up GPU passthrough, the size
parameter to munmap() is wrong and its operation not checked for errors,
therefore leaking resources.

Reported by:	Coverity Scan
CID:		1519830
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1262
2024-05-29 13:39:29 -06:00
Kristof Provost
cd2054d48b libpfctl: add pfctl_get_rule_h()
Add a handle variant of pfctl_get_rule(). This converts us from using
the nvlist variant to the netlink variant, and also moves us closer to a
world where all libpfctl functions take the handle.

While here have pfctl use the new function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-28 22:27:22 +02:00
Cy Schubert
018a4ab7b0 ntp: Update version strings
Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
MFC after:	3 days
Fixes:		f5f40dd63b
2024-05-27 02:19:51 -07:00
Cy Schubert
f5f40dd63b ntp: Vendor import of ntp-4.2.8p18
MFC:	3 days

Merge commit '1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad' into main
2024-05-26 18:41:22 -07:00
Joshua Kinard
a8f86ecd61 newsyslog: Fix case of the 'P' flag in newsyslog.conf(5)
PR: 279303
Reviewed-by: emaste
Signed-off-by: Joshua Kinard <freebsd@kumba.dev>
2024-05-26 21:34:14 -04:00
Warner Losh
364c014d9b cross-tools: fts has different types for cmp routine
fts has different types for its compare rotuine. Other systems, not
4.4BSD based, have a non-const version. Before we tested against
__GLIBC__, but now we test against __linux__ because that's Linux's API
and musl doesn't define __GLIBC__.

In addition, link against libftl on this platform since musl doesn't
include ftl routines in libc, but rather in libftl.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45349
2024-05-26 11:38:30 -06:00
Ed Maste
b128bedfb9 mptutil: correct man page date
PR:             279201
Fixes:          9a49a37929 ("mptutil: document that disabled/enab...")
Sponsored by:   The FreeBSD Foundation
2024-05-25 14:02:36 -04:00
Bjoern A. Zeeb
d33f5a0afa fwget: update wireless IDs for rtw88/89, ath1xk, mt76 and add iwlwifi
Update and add (new) PCI IDs for Realtek rtw88/89, Mediatek 7996/7925,
QCA ath1xk, and add Intel iwlwifi IDs.

Rather than using a package per driver add fine(r) grained flavors
even though it is a lot more likely to break in certain cases.

For Intel we need a great level of detail to match PCI IDs so also pass
the full pciconf -l line to into the pci_* files as "$2" to have access
to these.

This lines up with ports commit 80f50c9eb66d.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	manu (earlier version)
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D44918
2024-05-23 22:26:59 +00:00
Lexi Winter
77f06c476c rtadvd(8): support PREF64 (RFC 8781)
PREF64 allows a router to advertise the network's NAT64 prefix, allowing
clients to auto-configure CLAT.  This makes it possible to deploy
IPv6-only or IPv6-mostly client access networks without the need for
DNS64.

Reviewed by: imp, glebius (prior suggetions done)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1206
2024-05-23 14:40:48 -06:00
Lexi Winter
2356b60be7 arp(8): allow -i with -s
arp(8) usually disallows adding a static ARP entry for an IP address
which is not configured on a local interface.

Change this to allow such ARP entries to be added if '-i' is provided to
specify the interface the ARP entry relates to.

Due to limitations in the kernel lltable, this still requires that a
host route exists for the target address, but allows static ARP entries
to be configured to proxy ARP for, e.g., local jails which use an IPv4
address with a /32 route.

Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/1220
2024-05-23 14:02:57 -06:00
Zhenlei Huang
d76ef58d56 freebsd-update: Correctly check if pkg(8) is present
On systems without pkg(8) installed, `command -v pkg` will return
success and falsely report that pkg(8) is present. Fix that by checking
via the `pkg -N` form.

This is missing from the final revision of D39695.

Reported by:	delphij
Reviewed by:	fernape, delphij
Fixes:		bc0c6c9cf3 freebsd-update: Add check for kernel modules
Differential Revision:	https://reviews.freebsd.org/D45292
2024-05-23 12:10:17 +08:00
Christos Margiolis
e3b94b375e mixer(8): Use mixer_get_path()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45276
2024-05-23 02:57:43 +02:00
Christos Margiolis
0e80798518 mixer(8): Ignore mixer_open() failures for the -a option
The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45151
2024-05-23 02:57:25 +02:00
Oleksandr Kryvulia
6841c2677c zzz: Fix output formatting when suspend state not supported
Reviewed by: imp (who also simplified things a little)
Differenetial Revision: https://reviews.freebsd.org/D45299
2024-05-22 14:21:18 -06:00
Juraj Lutter
7618c9e163 daemon: Add -C (--restart-count) option
Add a new option (-C, --restart-count) to specify the maximum
number of times that the controlled process is restarted if
restart (-r) is restarted.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44944
2024-05-22 09:45:23 +02:00
Alexander Ziaee
7839534a5a autofs manuals: align lists, tag SPDX
MFC after: 3 days
Fixes: 286c4906d6 (add -noauto), 3914ddf8a7 (import autofs)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243
2024-05-21 17:41:04 -06:00
Renato Botelho
55d2990548 bsdinstall: Fix wifi network selection size
Use correct variable while creating dialog used to select among
available wireless networks

Approved by:	asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D45271
2024-05-20 13:39:29 -03:00
Mike Karels
0b39b2e2dd adduser: create dataset only if home is directly within dataset
Currently, if the prefix of the new home directory is a subdirectory
of a ZFS dataset, adduser will create a new dataset up one or more
levels from the intended destination.  "pw useradd" will then create
a normal directory in the desired location, leaving an unused dataset.
Check for this situation when determining whether to create a dataset,
and let pw create the directory.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45229
MFC after:	3 days
2024-05-20 08:43:34 -05:00
Konstantin Belousov
6cba29c09a acpidump IVRS table format: change 'IOMMUId' into 'IOMMU DeviceId'
and apply the consistent format for device ids used in other IVRS
elements.  The field seems to be the PCI Device ID of the IOMMU itself,
instead of an abstract unit ID.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-20 02:04:45 +03:00
Pierre Pronchery
f7d45c5443 bhyve: avoid side effect in assertion
An assert() was setting the error variable instead of checking it.

Reported by:	Coverity Scan
CID:		1521431
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1244
2024-05-17 15:45:18 -04:00
Pierre Pronchery
e9806d2128 bhyve: avoid resource leak in error path
In e820_finalize(), the e820_fwcfg_item variable, containing the
etc/e820 file (for the e820 table from the BIOS) is not free()'d when it
could not be added to the QEMU firmware configuration device (fw_cfg).

Reported by:	Coverity Scan
CID:		1522761
Reviewed by:	corvink, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45223
2024-05-17 12:26:27 -04:00
Pierre Pronchery
f38117359a ctladm: fix resource leak
The str variable in cctl_nvlist_end_element() does not get free()'d when
converted to an integer value. (name is "trtype")

Reported by:	Coverity Scan
Coverity ID:	1545039
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1237
2024-05-16 11:22:48 -06:00
Pierre Pronchery
1787871a66 bhyve: avoid resource leak
In bhyve_parse_config_option(), a string is allocated and passed to
nvlist_add_string() but not free'd afterwards.

Reported by:	Coverity
CID:		1544049
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1234
2024-05-16 11:19:33 -06:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Dag-Erling Smørgrav
46a619c6d4 adduser: Additional variable fixes.
One function used `_input` without making it local, causing its value to
leak into other functions.  This broke the `-f` case.  Fix that instance
and initialize all local variables that weren't already initialized.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels
Differential Revision:	https://reviews.freebsd.org/D45204
2024-05-15 14:13:49 +02:00
Fernando Apesteguía
47535ba3d3 bsdinstall: Remove unused variables in fetchmissingdists
ALL_DISTRIBUTIONS and VERIFY_MANIFEST_SIG

They are neither used in the script nor exported.
Not referenced anywhere in bsdinstall/*

Approved by:		imp@
Differential Revision:	https://reviews.freebsd.org/D42369
2024-05-12 19:25:06 +02:00
Dag-Erling Smørgrav
44e72c6e2e Add man page for nfslockd.
PR:		130238
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45139
2024-05-10 11:23:13 +02:00