Commit Graph

280462 Commits

Author SHA1 Message Date
Cy Schubert
1838dec318 unbound: Vendor import 1.17.1
Release notes at
    https://www.nlnetlabs.nl/news/2023/Jan/12/unbound-1.17.1-released/.

MFC after:      1 month

Merge commit '7699e1386a16236002b26107ffd2dcbde375e197' into main
2023-01-14 21:39:31 -08:00
Christos Margiolis
249526dace mixer(3): Add HEADNAME to TAILQ_HEAD declarations
This allows us to use the TAILQ_PREV and TAILQ_FOREACH_REVERSE_* macros,
useful for an out-of-tree consumer.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38055
2023-01-14 21:33:58 -05:00
Peter Holm
4dcc6baddb stress2: Added a regression test 2023-01-14 20:19:05 +01:00
Sean Eric Fagan
f32db40650 Allow a comma-separated list in login class capabilities,
by adding a version of strcspn that allows quoting.
2023-01-14 10:48:29 -08:00
Konstantin Belousov
6e1eabadcb ffs_syncvnode(): avoid a LoR for SU
There is another case where SU code does ffs_syncvnode(dvp) for the
parent directory dvp while the child vnode vp is locked.  Avoid the
issue by relocking and returning ERELOOKUP to indicate the need of
resync.

Reported by:	jkim
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37997
2023-01-14 20:28:11 +02:00
Konstantin Belousov
1d9f3a37eb Stop cleaning MNT_LOCAL on unmount
There is no point in clearing just this flag.  Flags are reset on the
struct mount re-allocation for reuse anyway.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37966
2023-01-14 20:28:11 +02:00
Dag-Erling Smørgrav
4a158fc030 depend-cleanup.sh: handle zic moving one level up.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38044
2023-01-14 18:17:22 +01:00
Dag-Erling Smørgrav
2aad7570f4 tzcode: Silence warnings.
* Ignore failure to remove our temp file.
* Avoid a minor memory leak in the -D case.

Reported by:	Coverity (CID 1502534, 1502535, 1502538)
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38038
2023-01-14 18:17:06 +01:00
Dag-Erling Smørgrav
55572cff58 tzcode: Fully initialize structs before use.
Reported by:	Coverity (CID 1502542, 1502548)
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38037
2023-01-14 18:16:52 +01:00
Dag-Erling Smørgrav
96e68c393f tzcode: Avoid memory leak if pthread_setspecific() fails.
Reported by:	Coverity (CID 1018472, 1018474)
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38036
2023-01-14 18:16:30 +01:00
Dag-Erling Smørgrav
3e2e5eebfa tzcode: Remove access() again, cf. 02ba1d993f.
Reported by:	Coverity (CID 1250126)
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38035
2023-01-14 18:16:17 +01:00
Poul-Henning Kamp
c389ad227b Typo, spotted by Matteo. 2023-01-14 14:53:12 +00:00
Poul-Henning Kamp
017de00844 Add a SVG version of vector-Beastie.
(If somebody with a proper vector-based drawingprogram replaced the
polylines with splines, the file would probably shrink by 80%.)
2023-01-14 14:30:53 +00:00
Cy Schubert
7699e1386a unbound: Vendor import 1.17.1
Release notes at
    https://www.nlnetlabs.nl/news/2023/Jan/12/unbound-1.17.1-released/.
2023-01-13 15:52:47 -08:00
Warner Losh
4883f347f6 stand: dev can't be NULL in default_prasedev
We pass in the address of a variable to store this value always in the
only place that calls this function, so there is no need to test for NULL.

Sponsored by:		Netflix
Notied by:		tsoome in D38041
2023-01-13 15:54:44 -07:00
Alan Somers
92e978439f cal: don't print terminal control characters unless stdout is a TTY
A similar change was made in svn r223931, but it was incomplete, working
only when the utility was invoked as "ncal".  Fix the same issue when
invoking as "cal".

PR:		268936
Reported by:	Ray Bellis <ray@bellis.me.uk>
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D38045
2023-01-13 14:30:00 -07:00
Warner Losh
eb1795782c kboot: Use standard set_currdev
Use the standard set_currdev instead of the (now very old) copy of
setting currdev and loaddev directly. We do this only when we don't go
find the ZFS pool to boot from.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38012
2023-01-13 14:22:39 -07:00
Warner Losh
b7ecfa195f kboot: Add hostdisk override
When hostdisk_override is set, all the /dev devices are hidden, and only
the files in that directory are used. This will allow filesystem testing
on FreeBSD without root, for example. Adjust the parse routine to not
require devices start with /dev (plus fix a leak for an error
condition). Add a match routine to allow the device name to be something
like "/home/user/testing/zfsfoo:" instead of strictly in /dev. Note:
since we need to look at all the devices in the system to probe for ZFS
zpools, you can't generally use a full path to get a 'virtual disk' at
this time.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38011
2023-01-13 14:22:39 -07:00
Warner Losh
4f3be6b8d9 kboot: Fetch hostfs_root and bootdev from the environment
Fetch bootdev from the environment variable (so it should be set on the
command line). Default to 'zfs:' which will in the future look for the
first zpool that we can boot from. Prior versions of kboot would set
this from the second argument on the command line.

Fetch hostfs_root from the environment (defaulting to '/'). Prior
versions of kboot would set this from the first arg on the command line.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38010
2023-01-13 14:22:39 -07:00
Warner Losh
42e37d8caf kboot: Add ZFS support build glue
Now that all the pieces are in place, allow kboot to be built with ZFS
support.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38009
2023-01-13 14:22:39 -07:00
Warner Losh
f20ecce33a kboot: Add support for ZFS volumes
Add the zfs device and filesystem to config and write the hook we need
to probe zfs since there's not a generic mechanism in place to do that
when ZFS is configured.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38008
2023-01-13 14:22:39 -07:00
Warner Losh
cc82c650a7 kboot: Add ZFS support to hostdisk
Add helper function to walk through the disk drives we've found to look
for zpools. main.c will still need to call this because the loader
hasn't implemented a good way to 'taste' drives for zpools and/or GELI
partitions (mostly because there's no generic list of candidate
devices).

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38007
2023-01-13 14:22:38 -07:00
Warner Losh
1a13008e98 kboot: Rework hostdisk.c to allow easier ZFS support.
Keep a list of disks and partitions that we have. Keep track of the
sizes of the media and sector and use that to implement DIOCGMEDIASIZE
and DIOCGSECTORSIZE. Proivde a way to lookup disks by name.

Sponsored by:		Netflix
Reviewed by:		kevans (prior version)
Differential Revision:	https://reviews.freebsd.org/D38013
2023-01-13 14:22:38 -07:00
Warner Losh
5385c7e13b stand/zfs: Fix memory leaking on error cases
Now that we return an allocated zfs_devdesc, we have to free it. These
frees were missing from the error cases. In addition, simplify the code
a bit for the out of memory case.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38006
2023-01-13 14:22:38 -07:00
Warner Losh
5740057b43 stand/uboot: Explain why we test for NULL here
Most parsedev routines assume that idev is non-null and can always be
set. Since we break from this pattern in uboot, explain why in a
comment. devparse was invented to put a lot of common code in one place
and to simplify the archsw.arch_getdev code and any dv_parsedev code
called. However, uboot couldn't use devparse at the time because its
device naming scheme slightly different parsing. So, we still use
uboot_parsedev directly from uboot_getdev where dev could be NULL. Add a
comment to this effect.

The match functionality added for ofw likely could be used to clean up
the multiple kludges that are here for uboot's device naming differences
with the normal boot loader. This work will wait for the future.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38042
2023-01-13 14:22:38 -07:00
Warner Losh
d38d8a4c4e stand/ofw: dev can't be NULL here
dev can't be NULL here. ofw_common_parsedev is always called via
devparse (indirectly through dv_parsedev() calls there which call it
with the args unchanged). In the past, ofw_getdev could call us with
NULL pointer for the parse-only case, but that's now all handled inside
of devparse for simplicity.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38041
2023-01-13 14:22:38 -07:00
Warner Losh
d1ea501714 stand: Separate base and cli parts of nvstore
zfs lives in libsa. However, it depends on nvstore (and other things)
that are in common. Fix part of this layering violation by splitting
nvstore into a libsa piece (which is the base implementation) and
keeping a much smaller common piece (to implement the nvstore
command). This just leaves zfs' knowledge of device names that's
specific to common and its calling platform specific init code to
resolve. Add a nvstore.h file for these two parts to communicate private
things and move the public nvstore api from bootstrap.h to stand.h.

Sponsored by:		Netflix
Reviewed by:		tsoome, kevans
Differential Revision:	https://reviews.freebsd.org/D38043
2023-01-13 14:22:38 -07:00
Kristof Provost
fd02192c3a pf: fix panic on deferred packets
The pfsync_defer_tmo() callout needs to set the correct vnet before it
can transmit packets. It used the rcvif in the mbuf to get this vnet,
but that doesn't work for locally originated traffic. In that case the
rcvif pointer is NULL, and the dereference leads to a panic.

Instead use the sc_sync_if, which is always set (if pfsync is enabled,
at least).

PR:		268246
MFC after:	2 weeks
2023-01-13 20:41:25 +01:00
Jose Luis Duran
bdd60b224f ipfw: Add missing 'va' code point name
Per RFC 5865, add the 'va' (VOICE-ADMIT, 101100) symbolic name.

Reviewed By: melifaro, pauamma
Differential Revision: https://reviews.freebsd.org/D37508
MFC after:	2 weeks
2023-01-13 20:21:27 +00:00
Justin Hibbits
7583c633e0 Mechanically convert ena(4) to DrvAPI
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D37837
2023-01-13 17:09:17 +01:00
Arthur Kiyanovski
e5de1d8dad ena: Update driver version to v2.6.2
Bug Fixes:
* Remove timer service re-arm on ena_restore_device failure.
* Re-Enable per-packet missing tx completion print

Minor Changes:
* Switch driver owners from Semihalf to Amazon in man file.

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/637
2023-01-13 17:07:04 +01:00
Arthur Kiyanovski
fb47286c38 ena: Switch driver owners from semihalf to amazon in man file
1. Update ena.4 manual file to include amazon owner emails.
2. State that the driver is developed by amazon but leave
that it was originally written by Semihalf, similarly to other
drivers in the /share/man/ directory of the FreeBSD source code.
3. Advance year in copyright notice to 2022.

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2023-01-13 17:06:43 +01:00
David Arinzon
c4a85b8d68 ena: Remove timer service re-arm on ena_restore_device failure
In case the reset sequence fails (ena_destroy_device() followed by
ena_restore_device() calls) during ena_restore_device(), the driver
resources are being freed. After the clean-up, the timer service is
re-armed in order to try and re-initialize the driver state.
But, such an attempt would fail given that the resources are freed.
Moreover, this would actually cause either the system to fail or a
panic.
When the driver fails in ena_restore_device() procedure, the only
recovery is either unloading and loading the driver or instance
reboot.

This change removes the timer service re-arm in case of failure
in ena_restore_device().

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Fixes: 78554d0c70 ("ena: start timer service on attach")
2023-01-13 17:06:43 +01:00
Arthur Kiyanovski
f01b2cd98e ena: Re-Enable per-packet missing tx completion print
Commit [1] first added the ena_tx_buffer.print_once member,
so that a message about a missing tx completion is printed only
once per packet (and not every second when the watchdog runs).
In this commit print_once is initialized to true, and is set back
to false after detecting a missing tx completion and printing
a warning about it to dmesg.

Commit [2] incorrectly reverses the values assigned to print_once.
The variable is initialized to be true but is checked to be false
when a missing tx completion is detected. This is never true, and
therefore the warning print for each missing tx completion is never
printed since this commit.

Commit [3] added time passed since last TX cleanup to the missing
tx completions per-packet print. However, due to the issue in commit
[2], this time is never printed.

This commit reverses back the values assigned to ena_tx_buffer.print_once
erroneously by commit [2], bringing back to life the missing tx
completion per-packet print.

Also add a space after "." in the missing tx completion print.

[1] - 9b8d05b8ac ("Add support for Amazon Elastic Network Adapter (ENA) NIC")
[2] - 74dba3ad78 ("Split function checking for missing TX completion in ENA driver")
[3] - d8aba82b5c ("ena: Store ticks of last Tx cleanup")

Fixes: 74dba3ad78 ("Split function checking for missing TX completion in ENA driver")
Fixes: d8aba82b5c ("ena: Store ticks of last Tx cleanup")
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2023-01-13 17:06:42 +01:00
Mark Johnston
568f552b04 kvmclock: Fix initialization when EARLY_AP_STARTUP is not defined
To attach to the hypervisor, kvmclock needs to write a per-CPU MSR.
When EARLY_AP_STARTUP is not defined, device attach happens too early:
APs are not yet spun up, so smp_rendezvous only runs the callback on the
local CPU.  As a result, the timecounter only gets initialized on the
BSP, and then timekeeping is broken on SMP systems.

Implement handling for !EARLY_AP_STARTUP kernels: keep track of the CPU
on which device attach ran, and then use a SI_SUB_SMP SYSINIT to
register the rest of the CPUs with the hypervisor.

Reported by:	Shrikanth R Kamath <kshrikanth@juniper.net>
Reviewed by:	kib, jhb (earlier versions)
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D37705
2023-01-13 10:37:37 -05:00
Tom Jones
110ce09c90 if_lagg: Allow lagg interfaces to be used with netmap
Reviewed by:	zlei
Sponsored by:	Zenarmor
Sponsored by:	OPNsense
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37436
2023-01-13 15:31:58 +00:00
Zhenlei Huang
8bce8d28ab jail: Avoid multipurpose return value of function prison_ip_restrict()
Currently function prison_ip_restrict() returns true if the replacement
buffer was used, or no buffer provided and allocation fails and should
redo. The logic is confusing and cause possibly infinite loop from
eb8dcdeac2 .

Reviewed by:	jamie, glebius
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D37918
2023-01-13 18:45:14 +08:00
Zhenlei Huang
89ddfbbac8 jail: Fix regression panic from eb8dcdeac2
And possibly infinite loop calling prison_ip_restrict() in
kern_jail_set() [2].

[1] It is possible that prisons do not have any IPv4 or IPv6 addresses.
[2] If prison_ip_restrict() is not provided with prison_ip, when it
    allocates prison_ip successfully, then it should return false to
    indicate not redo prison_ip_restrict() later.

Reviewed by:	glebius
Approved by:	kp (mentor)
Fixes:	eb8dcdeac2 jail: network epoch protection for IP address lists
Differential Revision:	https://reviews.freebsd.org/D37906
2023-01-13 18:45:14 +08:00
Zhenlei Huang
ddbf879d79 jail: Correctly access IPv[46] addresses of prison_ip
* Fix wrong IPv[46] addresses inherited from parent jail
* Properly restrict the child jail's IPv[46] addresses

Reviewed by:	melifaro, glebius
Approved by:	kp (mentor)
Fixes:	eb8dcdeac2 jail: network epoch protection for IP address lists
Differential Revision:	https://reviews.freebsd.org/D37871
Differential Revision:	https://reviews.freebsd.org/D37872
2023-01-13 18:45:14 +08:00
Alexander V. Chernikov
692e19cf51 netlink: add netlink to GENERIC@amd64
Netlink is a communication protocol defined in RFC 3549. It is async,
TLV-based protocol, providing 1-1 and 1-many communications between kernel
and userland. Netlink is currently used in Linux kernel to modify, read and
subscribe for nearly all networking states. Interface state, addresses, routes,
firewall, rules, fibs, etc, are controlled via Netlink.

Netlink support was added in D36002. It has got a number of improvements and
first customers since then:
* net/bird2 got netlink support, enabling route multipath in FreeBSD
* netlink-based devd notifications are being worked on ( D37574 ).
* linux(4) fully supports and depends on Netlink

Enabling Netlink in GENERIC targets two goals.
The first one is to provide stability for the third-party userland applications,
so they can rely on the fact that netlink always exists since 14.0 and potentially 13.2.
Loadable module makes life of the app delepers harder. For example, `net/bird2` can be
either build with netlink or rtsock support, but not both.

The second goal is to enable gradual conversion of the base userland tools
to use netlink(4) interfaces. Converting tools like netstat (D36529), route,
ifconfig one-by-one simplifies testing and addressing the feedback.
Othewise, switching all base to use netlink at once may be too big of a leap.

This change targets amd64, the other architectures will follow soon.

Differential Revision: https://reviews.freebsd.org/D37783
2023-01-13 10:22:40 +00:00
Hans Petter Selasky
e0d8add4af tcp_lro: Fix for undefined behaviour.
Make sure the size of the raw[] array in the lro_address union is
correctly set at compile time, so that static code analysis tools
do not report undefined behaviour.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-13 11:18:19 +01:00
Cheng, Huiming
8685d7b5cb xhci(4): Make sure allocated bandwidth is freed in hardware by unconfiguring endpoint.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-13 11:18:19 +01:00
Hans Petter Selasky
e4611d2626 usb(4): Call optional endpoint_uninit() when changing configuration or alternate setting.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-13 11:18:19 +01:00
Kristof Provost
933be8d74b pf: default syncookies to adaptive mode
The cost of enabling syncookies in adaptive mode is very low (basically
a single atomic add when we create a new half-open state), and the
payoff when under SYN flood is huge.

So, enable adaptive mode by default.

Suggested by:   Eirik Øverby
2023-01-13 23:14:25 +01:00
Kristof Provost
dc698b2cd5 pf tests: test fast port re-use with syncookies
When a src/dst ip/port tuple is re-used before the pf state fully
expires we clean up the state and create a new one, unless syncookies
are enabled.

Test this, by running two back-to-back nc sessions, with a fixed source
port. Move the interface and IP to a different (vnet) jail, to trick the
network stack into letting us do this.

MFC after:      2 weeks
Event:          Aberdeen hackathon 2022
Differential Revision:  https://reviews.freebsd.org/D36886
2023-01-13 23:14:17 +01:00
Kristof Provost
9c041b450d pf: fix syncookies in conjunction with tcp fast port reuse
Basic scenario: we have a closed connection (In TCPS_FIN_WAIT_2), and
get a new connection (i.e. SYN) re-using the tuple.

Without syncookies we look at the SYN, and completely unlink the old,
closed state on the SYN.
With syncookies we send a generated SYN|ACK back, and drop the SYN,
never looking at the state table.

So when the ACK (i.e. the third step in the three way handshake for
connection setup) turns up, we’ve not actually removed the old state, so
we find it, and don’t do the syncookie dance, or allow the new
connection to get set up.

Explicitly check for this in pf_test_state_tcp(). If we find a state in
TCPS_FIN_WAIT_2 and the syncookie is valid we delete the existing state
so we can set up the new state.
Note that when we verify the syncookie in pf_test_state_tcp() we don't
decrement the number of half-open connections to avoid an incorrect
double decrement.

MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D37919
2023-01-13 23:14:12 +01:00
Justin Hibbits
ae3301084d Revert "ifnet/API: Move the IfAPI from if_var.h to if.h"
<net/if.h> should be a fully user-facing header, so these APIs don't
belong there.  Revert and will find another approach.

This reverts commit fe33e0ab83.

Fixes:		fe33e0ab83
Sponsored by:	Juniper Networks, Inc.
2023-01-12 21:29:19 -05:00
Bjoern A. Zeeb
8aaefd0512 rtw88: use #define for NL80211_BAND_2GHZ instead of hardcoded number
Use NL80211_BAND_2GHZ instead of a hard coded 0 as array index for the
band.  While LinuxKPI provides a KPI compatibility some of these values
may not necessarily be KBI compatible (in this case they shoule be so
this is a NOP) and after all it is better style.

No functional change.

MFC after:	3 days
2023-01-13 01:05:01 +00:00
Bjoern A. Zeeb
f797d5f370 iwlwifi: mark a declaration for a non-existent function
iwl_trans_pcie_send_hcmd() does not seem to exist (anymore).  Mark it
as __linux__ so we can submit the cleanup with the next upstream run.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-13 01:01:40 +00:00
Rick Macklem
dcfa3ee44d nfsserver: Fix vrele() panic in nfsvno_open()
Commit 65127e982b removed a check for ni_startdir != NULL.
This allowed the vrele(ndp->ni_dvp) to be called with
a NULL argument.

This patch adds a new boolean argument to nfsvno_open()
that can be checked instead of ni_startdir, since mjg@ requested
that ni_startdir not be used. (Discussed in PR#268828.)

PR:	268828
Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D38032
2023-01-12 16:48:53 -08:00