Commit Graph

277088 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
d1f5aa5633 wtap: cleanup module Makefile
Remove comments and change whitespace.
Cleanup the opt_* and -nclude opt_global.h bits to avoid various warnings.
2022-08-01 19:49:59 +00:00
En-Wei Wu
fb1526ca27 wtap(4): Fix bug in wtap_node_write() and wtap_vap_create()
Originally, wtap_node_write() gets the wrong softc by iterating V_inet and
gets the ifp by string comparison, then gets softc by ifp->if_softc.
However, ifp->if_softc will not point to the correct softc owned by
ieee80211com, and thus causes a kernel panic.
Fix it by assigning softc to cdev's si_drv1 in wtap_vap_create()
and get the softc directly via dev->si_drv1 in wtap_node_write().

The cdev created by wtap_vap_create() use the name of ieee80211com
rather than the vap's name. It will cause the second vap based on
the same ieee80211com as first vap fail to create a device node
because the device node is already exists. Fix it by assigning
vap->iv_ifp->if_xname to cdev's name.

Sponsored by:	Google, Inc. (GSoC 2022)
Reviewed by:	adrian, cy, bz
Differential Revision: https://reviews.freebsd.org/D35752
2022-08-01 19:40:13 +00:00
Tom Jones
2c4276aaa2 diff3: Use variables for old and new in A scripts
This makes the code easier to follow, no functional changes intended

Sponsored by:	Klara, Inc.
2022-08-01 14:54:20 +01:00
Tom Jones
ca53a8445a diff3: Replace literal marker with variable
Sponsored by:	Klara, Inc.
2022-08-01 14:53:53 +01:00
Tom Jones
85d92faf43 diff3: Fix indentation
Sponsored by:	Klara, Inc.
2022-08-01 14:14:25 +01:00
Hans Petter Selasky
9f35dbfdc6 uftdi(4): Add new USB ID.
PR:		265514
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-08-01 13:26:58 +02:00
Alexander V. Chernikov
ae6bfd12c8 routing: refactor private KPI
* Make nhgrp_get_nhops() return const struct weightened_nhop to
 indicate that the list is immutable
* Make nhgrp_get_group() return the actual group, instead of
 group+weight.

MFC after:	2 weeks
2022-08-01 10:02:12 +00:00
Alexander V. Chernikov
f28532a0f3 tests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d
The test was failing due to the assert on lack of MSG_TRUNC flag in the
 output flags of recvmsg().
The code passed MSG_TRUNC, along with sufficient-size buffer to hold the
 message to-be-received to the recvmsg(), and expected MSG_TRUNC to be
 returned as well.

This is not exactly correct as a) MSG_TRUNC was not even a supported
 recvmsg() flag before be1f485d7d and b) it violates POSIX, as
 POSIX states it should be set only "If a message is too long to fit in
 the supplied buffers,".
The test was working before as the kernel copied input flags to the
 output flags. be1f485d7d changed that behaviour to clear MSG_TRUNC
 if it was present on the input.

Fix the test by checking POSIX-defined behaviour.

Discussed with:	glebius
2022-08-01 09:20:45 +00:00
Alexander V. Chernikov
5c23343b8c routing: convert remnants of DPRINTF to FIB_CTL_LOG().
Convert the last remaining pieces of old-style debug messages
 to the new debugging framework.

Differential Revision: https://reviews.freebsd.org/D35994
MFC after:	2 weeks
2022-08-01 08:55:07 +00:00
Alexander V. Chernikov
800c68469b routing: add nhop(9) kpi.
Differential Revision: https://reviews.freebsd.org/D35985
MFC after:	1 month
2022-08-01 08:52:26 +00:00
Alexander V. Chernikov
29029b06a6 routing: remove info argument from add/change_route_nhop().
Currently, rt_addrinfo(info) serves as a main "transport" moving
 state between various functions inside the routing subsystem.
As all of the fields are filled in directly by the customers, it
 is problematic to maintain consistency, resulting in repeated checks
 inside many functions. Additionally, there are multiple ways of
 specifying the same value (RTAX_IFP vs rti_ifp / rti_ifa) and so on.
With the upcoming nhop(9) kpi it is possible to store all of the
 required state in the nexthops in the consistent fashion, reducing the
 need to use "info" in the KPI calls.
Finally, rt_addrinfo structure format was derived from the rtsock wire
 format, which is different from other kernel routing users or netlink.

This cleanup simplifies upcoming nhop(9) kpi and netlink introduction.

Reviewed by:	zlei.huang@gmail.com
Differential Revision: https://reviews.freebsd.org/D35972
MFC after:	2 weeks
2022-08-01 07:41:07 +00:00
Alexander V. Chernikov
97ffaff859 net: constantify radix.c functions
Mark dst/mask public API functions fields as const to clearly
 indicate that these parameters are not modified or stored in
 the datastructure.

Differential Revision: https://reviews.freebsd.org/D35971
MFC after:	2 weeks
2022-08-01 07:32:40 +00:00
Alexander V. Chernikov
2717e958df routing: move route expiration time to its nexthop
Expiration time is actually a path property, not a route property.
Move its storage to nexthop to simplify upcoming nhop(9) KPI changes
 and netlink introduction.

Differential Revision: https://reviews.freebsd.org/D35970
MFC after:	2 weeks
2022-08-01 07:26:53 +00:00
Kirk McKusick
d22531d572 Identify each UFS/FFS superblock integrity check as a warning or fatal error.
Identify each of the superblock validation checks as either a
warning or a fatal error. Any integrity check that can cause a
system hang or crash is marked as fatal. Those that may simply
lead to poor file layoutor other less good operating conditions
are marked as warning.

Normally both fatal and warning are treated as errors and prevent
the superblock from being loaded. A new flag, UFS_NOWARNFAIL, is
added. When passed to ffs_sbget() it will note warnings that it
finds, but will still proceed with loading the superblock. Note
that when UFS_NOWARNFAIL is used, it also includes UFS_NOHASHFAIL.

No legitimate superblocks should fail as a result of these changes.
2022-07-31 22:07:20 -07:00
Kirk McKusick
184e3118c1 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Further updates based on analysis of the way the fields are used
in the various filesystem macros defined in fs.h.

Eliminate several checks for non-negative values where the fields
are checked for specific values. Since these specific values are
non-negative, if the value is a verified positive value then it
cannot be negative and such a check is redundant and unnecessary.

No legitimate superblocks should fail as a result of these changes.
2022-07-31 20:29:08 -07:00
Xin LI
0404b8c88f Deprecate minigzip(1) in preparation of removing it from base system.
Reviewed by:	emaste, pauamma
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D36000
2022-07-31 15:16:22 -07:00
Kirk McKusick
3e40d2cc61 Fix for 548045b a too aggressive UFS superblock integrity check.
Reported by: Jenkins
2022-07-31 07:49:50 -07:00
Gordon Bergling
321dc6ee7e find.1: Fix mandoc warnings and mention a useful manpage
- new sentence, new line
- unknown AT&T UNIX version: At v7
- no blank before trailing delimiter
- reference the ASCII(8) manual page

MFC after:	5 days
2022-07-31 16:38:10 +02:00
Gordon Bergling
b131efe3e5 sh.1: Fix a mandoc warning
- new sentence, new line

MFC after:	3 days
2022-07-31 16:23:27 +02:00
Gordon Bergling
2bf1b9984f uhsoctl.1: Fix the man page date
- STYLE: normalizing date format to: August 12, 2009

MFC after:	3 days
2022-07-31 12:27:10 +02:00
Gordon Bergling
98b610b506 uefi(8): Fix a typo in a source code comment
- s/intrrupt/interrupt/

MFC after:	3 days
2022-07-31 12:14:54 +02:00
Gordon Bergling
e24fd6d664 bluetooth(3): Fix a typo in a source code comment
- s/intrrupt/interrupt/

MFC after:	3 days
2022-07-31 12:13:13 +02:00
Gordon Bergling
37519e3ff3 qlnxe(4): Fix a typo in a source code comment
- s/pedning/pending/

MFC after:	3 days
2022-07-31 11:35:07 +02:00
Alexander V. Chernikov
27f107e1b4 routing: add debug printing helpers for rtentry and RTM* cmds.
MFC after:	2 weeks
2022-07-31 09:01:42 +00:00
Gordon Bergling
a4181a3ec3 mlx5en(4): Fix a typo in a source code comment
- s/functino/function/

MFC after:	3 days
2022-07-31 10:28:20 +02:00
Gordon Bergling
6c73ba1a28 cxgb(4): Fix a typo in a source code comment
- s/collissions/collisions/

Obtained from:	NetBSD
MFC after:	3 days
2022-07-31 09:59:03 +02:00
Kirk McKusick
b21582ee03 Add a flags parameter to the ffs_sbget() function that reads UFS superblocks.
Rather than trying to shoehorn flags into the requested superblock
address, create a separate flags parameter to the ffs_sbget()
function in sys/ufs/ffs/ffs_subr.c. The ffs_sbget() function is
used both in the kernel and in user-level utilities through export
to the sbget() function in the libufs(3) library (see sbget(3)
for details). The kernel uses ffs_sbget() when mounting UFS
filesystems, in the glabel(8) and gjournal(8) GEOM utilities,
and in the standalone library used when booting the system
from a UFS root filesystem.

The ffs_sbget() function reads the superblock located at the byte
offset specified by its sblockloc parameter. The value UFS_STDSB
may be specified for sblockloc to request that the standard
location for the superblock be read.

The two existing options are now flags:

UFS_NOHASHFAIL will note if the check hash is wrong but will still
   return the superblock. This is used by the bootstrap code to
   give the system a chance to come up so that fsck can be run to
   correct the problem.

UFS_NOMSG indicates that superblock inconsistency error messages
   should not be printed. It is used by programs like fsck that
   want to print their own error message and programs like glabel(8)
   that just want to know if a UFS filesystem exists on a partition.

One additional flag is added:

UFS_NOCSUM causes only the superblock itself to be returned, but does
   not read in any auxiliary data structures like the cylinder group
   summary information. It is used by clients like glabel(8) that
   just want to check for possible filesystem types. Using UFS_NOCSUM
   skips the superblock checks for csum data which allows superblocks
   that have corrupted csum data to be read and used.

The validate_sblock() function checks that the superblock has not
been corrupted in a way that can crash or hang the system. Unless
the UFS_NOMSG flag is specified, it will print out any errors that
it finds. Prior to this commit, validate_sblock() returned as soon
as it found an inconsistency so would print at most one message.
It now does all its checks so when UFS_NOMSG has not been specified
will print out everything that it finds inconsistent.

Sponsored by: The FreeBSD Foundation
2022-07-30 22:51:38 -07:00
Stefan Eßer
dc9e68ad01 calendar: clarify comment syntax in man page
The single line comment indicator '//' is only detected at the
beginning of a line or when following white space to allow URLs
in calendar entries.

MFC after:	3 days
2022-07-31 07:37:05 +02:00
Kirk McKusick
548045bf57 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Reorder a few checks to ensure fields have been checked before
using them to check other fields.

Add eight new checks mostly checking for non-negative values.

No legitimate superblocks should fail as a result of these changes.
2022-07-30 22:35:11 -07:00
Bjoern A. Zeeb
13a7663c52 iwlwifi firmware: update to -73 / newer builds for 9xxx
Update iwlwifi 22000 firmware to -73 and rebuilds for 9000/9260.
Update the driver to accept the newer version.

Firmware was obtained from linux-firmware at
150864a4d73e8c448eb1e2c68e65f07635fe1a66.

Sponsored by:	The FreeBSD Foundation
MFC after:	23 days
2022-07-31 00:41:33 +00:00
Konstantin Belousov
4690e20eed tools/uma/smrstress: fix kthread exit
By convention, kernel threads must call kthread_exit() instead of
blindly returning from the thread function.  We have some safety measure
in fork_exit(), which checks for the P_KPROC p_flag and does
kthread_exit() for kernel thread that forgot to do it itself.

But this workaround only works for kernel threads belonging to the
kernel process.  If a kernel thread is attached to the normal process
with live userspace, and does not call kthread_exit(), then the
workaround is not activated, and for amd64 at least, the return from the
thread function/fork_exit() results in the return to userspace with the
copy of frame from the thread that did kthread_add().

Practically for smrstress, this destroys the user stack of the still
active frame in the other thread, which was the caller of kthread_add().

Fix it by adding kthread_exit() to the thread function.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35999
2022-07-31 00:40:12 +03:00
Alan Cox
4670f90846 iommu_gas: Eliminate redundant parameters and push down lock acquisition
Since IOMMU map entries store a reference to the domain in which they
reside, there is no need to pass the domain to iommu_gas_free_entry(),
iommu_gas_free_space(), and iommu_gas_free_region().

Push down the acquisition and release of the IOMMU domain lock into
iommu_gas_free_space() and iommu_gas_free_region().

Both of these changes allow for simplifications in the callers of the
functions without really complicating the functions themselves.
Moreover, the latter change eliminates the direct use of the IOMMU
domain lock from the x86-specific DMAR code.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35995
2022-07-30 14:28:48 -05:00
Alexander V. Chernikov
be1f485d7d sockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().
Implement Linux-variant of MSG_TRUNC input flag used in recv(), recvfrom() and recvmsg().
Posix defines MSG_TRUNC as an output flag, indicating packet/datagram truncation.
Linux extended it a while (~15+ years) ago to act as input flag,
resulting in returning the full packet size regarless of the input
buffer size.
It's a (relatively) popular pattern to do recvmsg( MSG_PEEK | MSG_TRUNC) to get the
packet size, allocate the buffer and issue another call to fetch the packet.
In particular, it's popular in userland netlink code, which is the primary driving factor of this change.

This commit implements the MSG_TRUNC support for SOCK_DGRAM sockets (udp, unix and all soreceive_generic() users).

PR:		kern/176322
Reviewed by:	pauamma(doc)
Differential Revision: https://reviews.freebsd.org/D35909
MFC after:	1 month
2022-07-30 18:21:51 +00:00
Bjoern A. Zeeb
d8dd6b329e LinuxKPI: 802.11: add missing linuxkpi_cfg80211_bss_flush()
Add the missing implementation of linuxkpi_cfg80211_bss_flush().
without this we get unresolved symbols and drivers won't load.

Reported by:	eduardo, Berislav Purgar (bpurgar gmail.com)
MFC after:	3 days
X-MFC-Squash:	b0f7376822
2022-07-30 14:23:14 +00:00
Warner Losh
206203f530 stand: Add a helper 'universe' target
Add a shortcut for invokging ${SRCTOP}/tools/boot/universe.sh by
creating a 'universe' target in src/stand. This will make it easier to
test out all the different combinations of boot loaders that we build.

Sponsored by:		Netflix
2022-07-30 05:01:47 -06:00
Warner Losh
2101541ff1 stand: Move quit command to common commands
Since both EFI and the future kboot will benefit from a 'quit' command,
move it from efi/loader/main.c to common/commands.c. In EFI this command
exits back to the boot loader (which will cause the next BootXXXX in the
BootOrder list to be attempted). In kboot, this will exit back to
whatever called loader.kboot. In uboot this will cause a reset (which
will restart uboot, not quite a simple exit, but will look similar)
and in OFW it will execute OF_exit which should return to the
openfirmware prompt.

Sponsored by:		Netflix
2022-07-30 04:48:35 -06:00
Justin Hibbits
43eebd0364 mpc85xx/pci: Conditionally reset PCI bridges
Sometimes we need to reset a PCIe bus, but sometimes it breaks the
downstream device(s).  Since, from my testing, this is only needed for
Radeon cards installed in the AmigaOne machines because the card was
already initialized by firmware, make the reset dependent on a device
hint (hint.pcib.X.reset=1).  With this, AmigaOne X5000 machines can have
other devices in the secondary PCIe slots.
2022-07-29 21:54:20 -04:00
Zhenlei Huang
150486f6a9 Introduce and use the NET_EPOCH_DRAIN_CALLBACKS() macro
Reviewed by:	melifao, kp
Differential Revision:	https://reviews.freebsd.org/D35968
2022-07-29 21:21:10 +02:00
Neel Chauhan
b07a48d4f3 vmd: Add 8086:A77F PCI ID for all Intel Raptor Lake SKUs
Summary:
This is based on the Linux kernel commit
922bfd001d1ac02111ebbe0524aaab6ca7925521.

Reviewed by:		mav (src)
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D35996
2022-07-29 11:17:20 -07:00
Kirk McKusick
58cb362676 Fix for 90e2971 that caused some geli commands to return the wrong exit status.
The reported problem is that some geli commands exit with a
success status when they should exit with a failed status.

The gctl_error() function is defined differently in the kernel
(in sys/geom/geom_ctl.c) versus in the geom user facilities (in
sbin/geom/misc/subr.c). In the kernel, calling gctl_error() causes
an error return to be set while in the user version it does not.
It was only by a quirk that had been added to the user geom return
processing that I "cleaned up" that the lack of the user implementaion
to set the error return showed up.

This patch adds the missing setting of the error code when calling
the user facility gctl_error().

Reported by:  Jenkins
Debugging by: Alan Somers
Debugging by: Cy Schubert
Debugging by: Li-Wen Hsu
2022-07-29 11:11:46 -07:00
Bjoern A. Zeeb
b0f7376822 LinuxKPI: 802.11 header updates
While working on new and updates to drivers more structs, fields,
functions, .. were found, had to be shuffled around, ..
Some of these are (so far still dummy) functions or not properly
typed fields.  The IEEE80211_HE_ constants are all still dummy.
This was msotly as a start to make new (out-of-tree) things compile.

Sponsored by:	The FreeBSD Foundation (minor VHT/chan width bits)
MFC after:	1 week
2022-07-29 15:23:49 +00:00
Bjoern A. Zeeb
89c32dafa5 LinuxKPI: skbuff: sort list header and add new (dummy) functions
While working on new and updates to drivers more skbuff changes
came up.  Sort out the list/prev/next header problem and add more
(so far dummy) functions needed.

MFC after:	1 week
2022-07-29 15:21:48 +00:00
Bjoern A. Zeeb
195733401f net80211: change order in ieee80211_vhtchanflags()
While 80P80 is less likely to be used, VHT160 (a single contiguous
width) is harder to acquire but also preferable so return that first.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:    adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:52 +00:00
Bjoern A. Zeeb
dc32c71339 net80211: VHT correct check/option in ieee80211_vht_adjust_channel()
In ieee80211_vht_adjust_channel() we have to check for all possible
IEEE80211_FVHT_VHT* options using the mask rather than just checking
for IEEE80211_FVHT_VHT;  ieee80211_vhtchanflags() (contrary to its
HT counterpart) only returns the "highest" flag nor or-ing them together
with the base flag.  For the moment this seems to make sense as with
more width options we'd add a pyramid.

Later on, in the same function when we get VHT160 actually go and look
for VHT160 and not VHT80.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:45 +00:00
Bjoern A. Zeeb
656d0e8fa9 net80211: add VHT5G and VHT2G checks/return to media_status
Add the fields for VHT (2Ghz and 5Ghz) to report back by media_status
so we actually have a chance to get the right information.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:38 +00:00
Bjoern A. Zeeb
5c9f992919 net80211: improve DDB output.
Start adding more fields to DDB output related to VHT (11ac) and
mark COM, VAP, and STA more explicitly to make show all vaps /..
more readable.

Sponsored by:	The FreeBSD Foundaton
MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:31 +00:00
Bjoern A. Zeeb
463d6125e7 net80211: correct IEEE80211_FEXT_BITS
Correct IEEE80211_FEXT_BITS adding the missed one and move the later
one further.  This will actually make VHT to show.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:24 +00:00
Bjoern A. Zeeb
a78be09e4d net80211: add more 802.11ac Element IDs
Add more Element IDs for VHT (11ac) to complete the current list
and we can use them if/as needed.

Sposnored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:10:15 +00:00
Bjoern A. Zeeb
c7a8db6a85 net80211: radiotap: add one more define for HE
Add one more define for HE radiotap used by a driver.

MFC after:	1 week
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D35977
2022-07-29 15:09:55 +00:00
Alan Somers
a043594c21 ip6(4): document IP_ORIGDSTADDR
The option was originally added in r313524, but with incomplete
documentation.

MFC after:	1 week
Reviewed by:	karels, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D35890
2022-07-29 09:06:19 -06:00