Commit graph

297933 commits

Author SHA1 Message Date
Doug Moore
420e2f8a74 vnode_pager: simplify loop, avoid overflow
Filling in read-behind pages in vnode_pager_generic_getpages() is made
very slightly simpler here, by avoiding overflowing the startpindex
variable and then avoiding an extra test in the allocation loop that
handles the overflow case.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49200
2025-03-02 02:13:24 -06:00
Warner Losh
23da585dd4 pci(4): Give UEFI wiring example
Sponsored by:		Netflix
Reviewed by:		ziaee
Differential Revision:	https://reviews.freebsd.org/D49195
2025-03-01 22:19:11 -07:00
Adrian Chadd
e74a3c7585 net80211: add AES-GCM in ddb output
Add the AES-GCM crypto cipher field decode in ddb.

Differential Revision:	https://reviews.freebsd.org/D49188
Reviewed by:	bz
2025-03-01 17:35:23 -08:00
Adrian Chadd
4b86550923 ifconfig: add AES-GCMP RSN OUI decoding
This decodes the AES-GCMP OUI in ifconfig, ifconfig list sta,
ifconfig list scan, etc.

Differential Revision:	https://reviews.freebsd.org/D49187
Reviewed by:	bz
2025-03-01 17:35:08 -08:00
Konstantin Belousov
43fa7b907e amdiommu: add register definitions from IOMMU spec 48882 rev. 3.10
Most important for us is the max interrupt remapping count report in the
EFR2 register.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-03-02 03:23:41 +02:00
Adrian Chadd
10c633ab12 ath_rate_sample: fix setting HT rates
ieee80211_node_set_txrate_ht_mcsrate() takes an MCS rate from 0..76,
the high bit (IEEE80211_RATE_MCS) must not be set.

This is definitely my fault - I likely didn't get to testing this
diff when I changed it from ieee80211_node_set_txrate_dot11rate()
just before landing.

Differential Revision:	https://reviews.freebsd.org/D49197
Reviewed by:	bz
2025-03-01 15:32:56 -08:00
Adrian Chadd
50ec1e7af0 ath: fix 20MHz HT short-gi logic.
This was broken in an earlier commit

(ca389486a9).

PR:		kern/285096
Differential Revision:	https://reviews.freebsd.org/D49196
Fixes:	ca389486a9
Reviewed by:	bz
2025-03-01 15:32:04 -08:00
Justin Hibbits
c21c8a10d7 IfAPI: Update ifnet(9) man page
Add starting documentation of the IfAPI to the ifnet(9) page.  This
replaces the existing struct ifnet documentation, since it's to be
treated as opaque now.

Reviewed by:	#manpages, adrian, ziaee
Differential Revision: https://reviews.freebsd.org/D47931
2025-03-01 16:40:35 -05:00
Ed Maste
a18be39aaf makefs: Initialize cd9660 inode map only once
Error introduced during a refactoring; cd9660_susp_initialize calls
itself recursively.

Sponsred by:	The FreeBSD Foundation
Fixes: 35a2e286157a ("makefs: Record inode for all entries in mtree mode")
2025-03-01 08:35:15 -05:00
Eric Joyner
7ee310c80e igc(4): Fix attach for I226-K and LMVP devices
Summary:
The device IDs for these were in the driver's list of PCI ids to attach
to, but igc_set_mac_type() had never been setup to set the correct mac
type for these devices. Fix this by adding these IDs to the switch block
in order for them to be recognized by the driver instead of returning an
error.

This fixes the igc(4) attach for the I226-K LOM on the ASRock Z790
PG-ITX/TB4 motherboard, allowing it to be recognized and used.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	kbowling@
MFC after:	3 days
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D49147
2025-02-26 10:15:38 -08:00
Konstantin Belousov
e2dd73cf45 open.2: minor editing
Remove unneeded braces.
Bump Dd.

Suggested and reviewed by:	maxim
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-03-01 02:12:07 +02:00
Gleb Smirnoff
a80bbc4e95 netlink: refuse a send(2) that is larger than socket buffer
The Netlink RFC doesn't say that explicitly, but general discussion seems
to state that a single netlink message shall be delivered in a single
send(2) to the socket.  So, if a single message doesn't fit into buffer it
is clear EMSGSIZE.  The RFC is unclear if application is allowed to send
several smaller messages with a single syscall potentially overflowing the
buffer and whether kernel should accept any of them.  At the moment, no
legit application does that.  So, decision was taken not to overload
nl_sosend() with a message parsing logic and deny any oversized write.

Reported-by:	syzbot+eb5db60d36b005dbccf5@syzkaller.appspotmail.com
2025-02-28 15:39:15 -08:00
Dave Cottlehuber
457d745d90 release: ensure default sudo flavor is selected
pkg behaviour selects the non-default flavour, this trims
0,5GiB per cloudware image, by being explicit.

Approved by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D48599
Sponsored by:	SkunkWerks, GmbH
PR:		284278
MFC after:	10 days
2025-02-28 22:33:46 +00:00
Ed Maste
337f5e7a44 makefs: Compare pointer against NULL, not 0
Reported by:	rpokala
Sponsred by:	The FreeBSD Foundation
Fixes: 35a2e286157a ("makefs: Record inode for all entries in mtree mode")
2025-02-28 16:17:34 -05:00
Cheng Cui
67787d2004
tcp: make inflight data (pipe) calculation consistent
Reviewed by: glebius, rrs, tuexen
Differential Revision: https://reviews.freebsd.org/D49047
2025-02-28 15:53:12 -05:00
Ed Maste
518cdd344e makefs: Make cd9660 Rock Ridge inodes reproducible
Rock Ridge extensions include an inode field:

    "POSIX File Serial Number" shall have the same meaning as and may be
    used for the st_ino field of POSIX:5.6.1. This field shall be
    recorded according to ISO 9660:7.3.3. Directory Records which share
    the value of this field are defined as links (see POSIX:2.2.2.17)
    and, by definition, point to the same file or directory.

Previously we'd store the source file's st_ino (except that in metalog
mode we'd record 0 for files with nlink = 1).  This had two issues: the
generated ISO image was nonreproducible due to the arbitrary inode
numbers, and files without hard links would falsely be detected (by
certain tools) as hard links to each other.

Note that the kernel's cd9660(5) file system ignores the Rock Ridge
PX File Serial Number, so this issue isn't observed by mounting such a
file system.

Instead of using the source inode directly, assign target inode numbers
sequentially.  Use a map so that files with the same source inode (hard
links) still receive the same target inode number.

PR:		284795
PR:		285027
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49141
2025-02-28 15:34:52 -05:00
Cy Schubert
628715fdcc ntp: NULL pointer deref when create_interface() fails
Fix NULL pointer dereference when create_interface() fails in
update_interfaces(). The upstream bug report says a typo was introduced
by https://bk.ntp.org/ntp-dev/ntpd/ntp_io.c?PAGE=diffs&REV=66175036PETA6g__fON8oNrjL54Ttw. ep should have been ep2.

Fix obtained from upstream bug report.

PR:		285065
Upstream bug:	https://bugs.ntp.org/show_bug.cgi?id=3939
MFC after:	1 minute
2025-02-28 07:53:22 -08:00
Ed Maste
8a3537aaf7 Makefile.inc1: Make package timestamps reproducible by default
Set package archive timestamps based on most recent source commit
timestamp (approach suggested by bapt).

I'd like to include git metadata in a file included in src tarballs, so
that the build is reproducible (including the hash shown in uname etc.)
outside of a git checkout.  There are still details to be sorted out to
do that, so this is an interim step to improve reproducibility.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D49165
2025-02-28 10:11:52 -05:00
Andrey V. Elsukov
f2644d64b4 routing: set net.route.multipath=0 when kernel doesn't have ROUTE_MPATH
MFC after:	1 week
2025-02-28 17:05:47 +03:00
Ed Maste
ae2b84d9ab man4: Fix duplicate if_rtw89.4 MLINK
Fixes: 4262dbc579 ("wifi manuals: Mlink + document description consistency")
Sponsored by:	The FreeBSD Foundation
2025-02-28 08:33:14 -05:00
artembunichev
8cebb06300 open.2: add separate paragraph for O_CREAT
PR:	284353
MFC after:	1 week
2025-02-28 12:29:12 +02:00
Kevin Lo
5c7087c349 ixgbe: Fix a logic error in ixgbe_read_mailbox_vf()
Reviewed by:	kbowling
Differential Revision:	https://reviews.freebsd.org/D49156
2025-02-28 16:12:00 +08:00
Adrian Chadd
92caff2b1b wlanwatch: clean up to compile / run
* add static where needed
* delete old unused flags, dating back to the initial commit from Sam
* indirect through void * where appropriate, to avoid LLVM alignment
  errors
* PRIu64 where needed

This does work, but it currently doesn't track the ifname itself,
so we see ifindexes, not ifnames:

Wed Feb 26 18:35:59 RTM_IEEE80211: if# 2, scan complete
Wed Feb 26 18:35:59 RTM_IEEE80211: if# 2, associate with 30🇩🇪4b:db:46:0a
Wed Feb 26 18:35:59 RTM_IFINFO: if# 2, link: up, flags:<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>

.. but it does work!

Differential Revision:	https://reviews.freebsd.org/D49149
2025-02-27 18:49:49 -08:00
Adrian Chadd
db80116da4 wlanwds: add pidfile support
Add pidfile support based on "man pidfile".

Differential Revision:	https://reviews.freebsd.org/D48997
2025-02-27 18:49:49 -08:00
Adrian Chadd
571743bdc6 wlanwds: use a local copy of the ifaddr sockaddr, avoid cast
Using the cast results in alignment errors from LLVM.
Fix it to go through void *.

Differential Revision:	https://reviews.freebsd.org/D48996
2025-02-27 18:49:49 -08:00
Adrian Chadd
36347cfbf7 wlanwds: convert getifaddrs() iteration to use the ifa_next pointer
I don't know what I was thinking in 2017 when I wrote this, but
it's very wrong.

Use ifa->ifa_next to iterate, not the array index / pointer arithmetic.

Differential Revision:	https://reviews.freebsd.org/D49148
2025-02-27 18:49:49 -08:00
Alexander Ziaee
4262dbc579
wifi manuals: Mlink + document description consistency
Interfaces all have an mlink to if_$foo. Add these for the missing ones
and remove an incorrect one from rtwn_pci. Wireless network drivers are
all accessible via `apropos -s4 "wireless network driver", except two
which are "wireless network device". I actually prefer the latter, but
make them all consistent upon the more common parlance. Tag SPDX on one
of the files I touched, while here.

MFC after:		3 days
Reviewed by:		bz, carlavilla, mhorne
Approved by:		carlavilla, mhorne (mentors)
Differential Revision:	https://reviews.freebsd.org/D49063
2025-02-27 17:20:22 -05:00
Olivier Certner
d3c4b002d1
queue: Fix STAILQ_ASSERT_EMPTY()
The 'while' part corresponding to the 'do' was missing.

Did not notice the problem as later commits using it have been stashed
and never reworked up to now, and it is currently unused in the tree.

While here, fix spacing after the '#define' in the !(_KERNEL &&
INVARIANS) part.

Fixes:          34740937f7 ("queue: New debug macros for STAILQ")
MFC after:      1 minute
Sponsored by:   The FreeBSD Foundation
2025-02-27 22:04:17 +01:00
Piotr Pawel Stefaniak
2980318b27 sh.1: extend the section about getopts
Provide more details about the influence of optargs' first character
on the shell's behavior in regard to invalid arguments. Also do some
minor word-smithing.

Original submission by rea@

Differential Revision:	https://reviews.freebsd.org/D49106
2025-02-27 18:39:29 +01:00
Doug Moore
6b33d9dc46 vm_page: expose page_alloc_after
vm_page_alloc() just calls vm_page_alloc_after(), after it has found
the predecessor of a page parameter. Many callers of vm_page_alloc()
already know that predecessor. Letting them pass that to
vm_page_alloc_after() directly could save a little redundant
calculation.

Reviewed by:	alc
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D49103
2025-02-27 10:55:33 -06:00
Zhenlei Huang
97309cec6f netinet: Make in_ifhasaddr() return bool
No functional change intended.

MFC after:	1 week
2025-02-27 23:58:20 +08:00
Zhenlei Huang
69beb16284 netinet: Make in_localaddr() return bool
It is used as a boolean function everywhere.

No functional change intended.

MFC after:	1 week
2025-02-27 23:58:20 +08:00
Kajetan Staszkiewicz
f6f116cdbd pf: Make af-to work on outbound interface
Currently af-to works only on inbound interface by creating a reversed
NAT state key which is used to match traffic returning on the outbound
interface.

Such limitation is not necessary. When an af-to state is created
for an outbound rule do not reverse the NAT state key, making it work
just like if it was created for a normal NAT rule. Depending on firewall
design it might be easier and more natural to use af-to on the outbound
interface.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D49122
2025-02-27 16:28:27 +01:00
Stefan Eßer
ab6a311c72 libc/gen/fts.c: fix assignment
Fix typo in commit e59991206b ("==" instead of "=" for the assignment
of st_ino).

Reported by:	Coverity Scan CID 1592442
Approved by:	kib
Fixes:		e59991206b fts(3): be less strict when automount does its job under us walking autofs mount
2025-02-27 10:29:17 +01:00
Wei Hu
9b8701b81f mana: refill the rx mbuf in batch
Set the default refill threshod to be one quarter of the rx queue
length. User can change this value with hw.mana.rx_refill_thresh
in loader.conf. It improves the rx completion handling by saving
10% to 15% of overall time with this change.

Tested by:	whu
MFC after:	2 weeks
Sponsored by:	Microsoft
2025-02-27 08:08:13 +00:00
Kristof Provost
8a85584785 pf: fix incorrect calls to pf_translate_icmp_af()
The 'iih' argument is already a pointer, pass it as is rather than its address.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-26 23:40:40 +01:00
Kyle Evans
181549c37f libbe: avoid copying encryption-related props
libzfs insists that these be cloned from the origin, so avoid making a
deep copy of them ourselves to unbreak creating a new BE from a BE with
encrypted components -- in today's environment, without a loader that
does encryption, this means a deep BE setup where something underneath
the BE (e.g., home directories) are encrypted.

Reported and tested by:	arrowd
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D48464
2025-02-26 16:24:24 -06:00
Adrian Chadd
17e8437e8d net80211: update get_sta_info() to only populate isi_txrate for legacy rates
The isi_txrate field is 8 bits and only represents legacy/HT rates.
So to avoid logging a warning, only populate if it's a legacy/HT
rate.

Differential Revision:	https://reviews.freebsd.org/D48616
2025-02-26 11:31:27 -08:00
Adrian Chadd
e274a23c0d net80211: migrate ieee80211_rate2media() to use ieee80211_node_txrate
This is one of the two obvious left-over dot11rate lookups that trigger
a debug print.  (The other is get_sta_info()).

* Change ieee80211_rate2media() to use the passed in ieee80211_node_txrate
  and use the rate type field to see if it's legacy/ht or vht.
* .. and (I hope!) actually handle the VHT rate correctly.
* Change the callers of ieee80211_rate2media() to use the new static
  initialisers.

For the one spot in ieee80211_ht.c which uses the HT initialiser, it should
just be a straight up mechanical change that correctly sets the HT MCS
rate.

For the rest of them in ieee80211.c, they're doing table initialisation
for the media types / rates, and it's currently very focused on legacy
rates.  So just leave that all as-is for now with a mechanical change.

Differential Revision:	https://reviews.freebsd.org/D48615
2025-02-26 11:31:27 -08:00
Adrian Chadd
62823019db net80211: add static initialisers for the ieee80211_node_txrate options
Add static initialisers for legacy, ht and vht rates.

Differential Revision:	https://reviews.freebsd.org/D48614
2025-02-26 11:31:26 -08:00
Adrian Chadd
6fef9e7378 net80211: update ieee80211_node_get_txrate_mbit() to support VHT
Update ieee80211_node_get_txrate_mbit() to use
ieee80211_phy_vht_get_mcs_kbit() to calculate VHT rates.

For now just assume long-GI; I'd have to go and do some extra
work to figure out which short/long GI flag to use.

Differential Revision:	https://reviews.freebsd.org/D48613
2025-02-26 11:31:26 -08:00
Adrian Chadd
ff0e22f88d net80211: add ieee80211_phy_vht_get_mcs_kbit()
Add ieee80211_phy_vht_get_mcs_kbit(), which calculates the VHT rate
in kbit/sec.

Differential Revision:	https://reviews.freebsd.org/D48612
2025-02-26 11:31:25 -08:00
Adrian Chadd
4b2c7dfe76 net80211: add VHT MCS in AMRR rate control
This is a simple implementation, similar to HT, to generate
VHT MCS rates for testing.

I've verified it seems to do the right thing through
MCS 0..9 and NSS 1..2.  It's not very optimal - same issues as
with 11n - but it at least now fully tests the 11ac TX path in
rtwn and the tx rate refactoring.

Differential Revision:	https://reviews.freebsd.org/D48611
2025-02-26 11:31:24 -08:00
Adrian Chadd
078acac882 net80211: refactor amrr_node_init() into HT and legacy paths
Refactor amrr_node_init() into HT and legacy paths, clean up the
printing to be a bit clearer about the selected rates.

This is precursor work to setting VHT rates in ni->ni_txrate .

Differential Revision:	https://reviews.freebsd.org/D48429
2025-02-26 11:31:24 -08:00
Adrian Chadd
e99cbea414 net80211: refactor amrr_update() into HT and legacy paths
Split the amrr_update() routine into HT and legacy paths.
Currently they're the same, minus HT / non-HT specific comments
and some logging changes.

HT rates don't monotonically go up (ie, going MCS 7 -> MCS 8 is wrong,
as MCS8 is "just" two stream MCS0) and failing a rate by a little
shouldn't necessarily preclude testing the next rate up.

This should be a no-op, besides the logging changes.

Locally tested:

* RTL8192CU, STA mode

Differential Revision:	https://reviews.freebsd.org/D48248
Reviewed by:	bz, thj
2025-02-26 11:31:21 -08:00
Adrian Chadd
7b0e3c5b2b net80211: add ieee80211_vht_node_check_tx_valid_mcs()
Introduce ieee80211_vht_node_check_tx_valid_mcs(), which takes the
node, bandwidth, NSS and MCS and validates whether that is possible
to TX to the given node.

Differential Revision:	https://reviews.freebsd.org/D48610
Reviewed by:	bz, thj
2025-02-26 11:31:02 -08:00
Adrian Chadd
1086f7bab3 net80211: add node VHT transmit rate helper functions
* add a node VHT transmit function, which configures the parameters
  accordingly.

* add a node VHT transmit function which just copies in another
  ieee80211_node_txrate struct.

Differential Revision:	https://reviews.freebsd.org/D48609
Reviewed by:	bz
2025-02-26 11:30:51 -08:00
Adrian Chadd
1568caaf57 net80211: add valid VHT MCS combinations and helper functions
Not all NSS / MCS / channel bandwidth combinations are valid.

This will be important for rate control and transmit rate
setup (eg static management, unicast, multicast rates.)

This is based on 802.11-2020 Section 21.5 (Parameters for VHT-MCSs.)

Differential Revision:	https://reviews.freebsd.org/D48608
Reviewed by:	bz
2025-02-26 11:30:51 -08:00
Adrian Chadd
1c746222c2 net80211: Implement ieee80211_setup_vht_rates()
Implement ieee80211_setup_vht_rates() - calculate the intersection between
the peers advertised RX VHT MCS map and the vap's configured TX map.

Whilst here, remove the unused vhtcap/vhtinfo fields; they're
already populated in the ieee80211_node before ieee80211_setup_vht_rates()
is called.

Differential Revision:	https://reviews.freebsd.org/D48607
Reviewed by:	bz
2025-02-26 11:30:23 -08:00
Adrian Chadd
fdc8841611 rtwn: move to using ieee80211_node_get_txrate()
Migrate the transmit path to use ieee80211_node_get_txrate(), and handle
VHT rates.

Nothing is currently setting VHT rates, but the driver should now
be ready.

Differential Revision:	https://reviews.freebsd.org/D48606
Reviewed by:	bz
2025-02-26 11:30:01 -08:00