netlink: Parse repeated nested attributes
Modern Netlink arrays encode their elements as repeated attributes of
the same type rather than as children of an additional array container.
Add an SNL callback that parses one nested element for each occurrence
and appends it to a geometrically grown parser array. Retain the
existing parray callback for protocols that use the legacy container
form.
Store the growth capacity in struct snl_parray, appended after its
existing public count and items fields so their offsets remain stable
on LP64 and ILP32. Require parser targets to be real snl_parray
objects, and convert bitset, generic Netlink, and route multipath arrays
accordingly. This avoids relying on layout aliases for private growth
state.
Add regression coverage for a nested bit array that grows beyond its
initial allocation, while preserving replacement semantics when a
[5 lines not shown]
linux: Add STF type and convert some if_type to ARPHRD
Convert IFT_BRIDGE and IFT_L2VLAN to ARPHRD_ETHER, and IFT_LOOP
to ARPHRD_LOOPBACK in linux netlink.
Also, add ARPHRD_SIT and convert IFT_STF to it.
Reviewed by: kfv
Differential Revision: https://reviews.freebsd.org/D58573
nhop.9: Rewrite relics of rtentry.9 into nhop.9
Parts of rtentry.9 information such as information related to
the nexthop is outdated.
Remove those relics and add the new design into separate
manual instead.
Reviewed by: bcr
Discussed with: ziaee
Differential Revision: https://reviews.freebsd.org/D58564
LinuxKPI: 802.11: deal with wdev list, and misc
Fill in more (lvif) wdev details and add it to the list under the wiphy
struct so that iterators at least work and find the (one) device.
This is needed for the upcoming espwl(4) driver.
misc: add WPI-SMS4 to the list of cipher suits (we won't support it but
at least print the name).
MFC after: 3 days
LinuxKPI: 802.11: add more defines, structures, ...
Add more defines, structures, sort struct field types, add inline
functions (partially implemented) all needed for the upcoming
espwl(4) wireless driver.
MFC after: 3 days
shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks
This is ABI-breaking change that could be considered as the bug fix.
Requested by: David Timber <dxdt at dev.snart.me>
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
Relnotes: yes
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58942
tools/build: stage stdckdint.h's dependencies for non-FreeBSD hosts
37bd69d43c7 gave stdckdint.h two new includes, <sys/_visible.h> and
<sys/ckdint.h>. Neither reaches a non-FreeBSD host: _visible.h is
staged only under ${.MAKE.OS} == "FreeBSD" and ckdint.h is not staged at
all, so the libc bootstrap fails on reallocarray.o when cross-building
from macOS. Both headers are self-contained; stage them alongside
stdckdint.h.
Fixes: 37bd69d43c7 ("sys: Add sys/ckdint.h")
Reviewed by: rpaulo, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58943
vmm: Emulate CPUID leaf 1Fh for guests
On an Intel N150 host a guest started with sockets=1, cores=4,
threads=1 reports "1 package(s) x 2 core(s) x 2 hardware threads"
instead of four cores with one thread each, while the host itself
detects its topology correctly.
A FreeBSD guest picks the topology leaf in topo_probe_intel_0xb(),
sys/x86/x86/mp_x86.c, and since 6badb512a94d it prefers leaf 1Fh over
leaf 0Bh whenever cpu_high is 1Fh or higher. bhyve passes leaf 0
through unmodified, so the guest sees the maximum basic leaf of the
host, which is 1Fh or above on Alder Lake and newer, and takes that
path. x86_emulate_cpuid(), sys/amd64/vmm/x86.c, derives the topology
from vm_get_topology() for leaves 1, 4 and 0Bh, but has no case for
1Fh, so the request ends up in default_leaf and the host values are
returned verbatim. The guest therefore enumerates the topology of the
host: with an SMT shift of 1 in the host's leaf 1Fh and four vCPUs this
gives core_id_shift = 1 and pkg_id_shift = 2, which is exactly the
reported 2 cores x 2 threads. Hosts whose maximum basic leaf is below
[13 lines not shown]
libc: Restore prior C23 include guards
To avoid any sort of POLA violation, this commit restores old
guards and defines the C23 feature test macros in addition to
them. This is to close off whole class of possible breakage,
rather than patching it case by case.
Reported by: dim
Reviewed by: dim, dteske, fuz
Approved by: dim, dteske (mentor), fuz (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D58911
contrib/netbsd-tests: lib/libc/c063: sync with NetBSD
This change syncs the lib/libc/c063 NetBSD tests with FreeBSD. This does
two things:
- Addresses bogus tautologically true assertions flagged by clang and gcc
with ATF 0.22+ [1].
- Brings in some new test coverage.
Obtained from: NetBSD (date tag: `20260818UTC`)
MFC after: 2 weeks
1. https://github.com/freebsd/atf/pull/72
net80211: migrate the ioctl API to a 128 bit specific API + use key API
* Begin migrating the ioctl code to use the key management APIs.
Not all of it has been migrated (notably the WEP API hasn't.)
* Take special care to copy the TKIP MIC in and out correctly.
* Note that some of the defines used as sizes are actually the ioctl
sizes, they'll need to be fixed before I push this into a review.
* Document this current API as a specific 128 bit key + 128 bit
TKIP MIC API.
The goal here is to solidify this stuff as the 128 bit ioctl API
and not change it, even if net80211 will eventually grow 256 and
384 bit key support.
Notably the TKIP stuff - the driver_bsd.c code puts the TKIP after
the normal key contents, whereas the net80211 code puts the TKIP
[6 lines not shown]
net80211: add key get/set methods
Introduce net80211 key get and set methods with appropriate
bounds checking and buffer zero'ing.
Differential Revision: https://reviews.freebsd.org/D58705
net80211: fix WEP transmit
This was broken in 2022 with a security fix (61605e0ae5d8f) which
disallowed defaulting to the default TX key if there's no unicast
key. Unfortunately this path was also used by WEP transmit.
To fix it, add a separate check which ensures that WEP is configured
(authtype OPEN, privacy enabled) - then also check if the default TX
key is set and that said key is a WEP key.
Fixes: 61605e0ae5d8f
Locally tested:
* rtwn(4) AP and rtwn(4) STA w/ static WEP keys configured
Differential Revision: https://reviews.freebsd.org/D58854
libexpat: update AUTHORS section of libbsdxml.3
The eXpat project has changed maintainers since this section was written
in 2002. Update it to reflect reality.
Discussed with: Sebastian Pipping <sebastian at pipping.org>
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D58835
(cherry picked from commit 5e6c894510fc66c18d69164d591184a2d23b16e5)