]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 months agolinux(4): Regen for struct l_old_stat changes
Dmitry Chagin [Fri, 28 Apr 2023 08:55:01 +0000 (11:55 +0300)]
linux(4): Regen for struct l_old_stat changes

(cherry picked from commit 023e6884967d0cb0b330eb15264d159619b0533b)

12 months agolinux(4): Update syscalls.master to reflect struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Update syscalls.master to reflect struct l_old_stat

(cherry picked from commit 2370c7321fd392cfd23059760a816e852c921cde)

12 months agolinux(4): Mark old fstat syscal as unimplemented
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Mark old fstat syscal as unimplemented

It looks like the old fstat system call never been implemented.

(cherry picked from commit 391fd1e1a1e8d360d4ebaceecf1ab7c46063b257)

12 months agolinux(4): Rename obsolete old struct l_stat to struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Rename obsolete old struct l_stat to struct l_old_stat

(cherry picked from commit a408fc097f43b80fd1477196e595edc796804520)

12 months agolinux(4): Move statx_copyout() close to linux_statx()
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Move statx_copyout() close to linux_statx()

Just for future changes of the conditional Linuxulator build. We need
a small refactoring of the MI code to help porting Linuxulator to other
platforms.

(cherry picked from commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6)

12 months agolinux(4): Move translate_vnhook_major_minor() into the Linux common module
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Move translate_vnhook_major_minor() into the Linux common module

(cherry picked from commit 6072eea0c375fc3ab0cf5bb494c75d1beac7b8ba)

12 months agolinux(4): Sort includes in the linux_stats.c
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Sort includes in the linux_stats.c

(cherry picked from commit 2a38f51c5b8a7cf38f0a29a59e7558d8aef91047)

12 months agolinux(4): Use inlined LINUX_KERNVER for tests to improve readability
Dmitry Chagin [Wed, 26 Apr 2023 13:57:30 +0000 (16:57 +0300)]
linux(4): Use inlined LINUX_KERNVER for tests to improve readability

MFC after: 1 month

(cherry picked from commit e185d83fc48ba0f28896a986104c02203005b533)

12 months agolinux(4): Don't relie on process osreldata when testing features
Dmitry Chagin [Wed, 26 Apr 2023 13:56:41 +0000 (16:56 +0300)]
linux(4): Don't relie on process osreldata when testing features

The ELF note identifyies the operating-system ABI that the executable
was created for. The note data of the Glibc executable contains the
earliest release number of the Linux kernel that supports this ABI.
As of a current 2.37 version of Glibc, it is 3.2.0 for x86, 3.7.0
for Aarch64.
Glibc does not use this release number and the current kernel's
LINUX_VERSION_CODE to detect kernel features, using fallbacks to known
previous way in case of ENOSYS or something else instead.

A dynamically linked Glibc reads the current kernel's LINUX_VERSION_CODE
from the ELF note in the vDSO or fallback to uname syscall if the vDSO
can't be located and parse the release field in struct utsname. Glibc
uses the current kernel's LINUX_VERSION_CODE for "kernel too old" check.

While here use inlined LINUX_KERNVER for tests to improve readability,
as suggested by emaste@.

MFC after: 1 month

(cherry picked from commit 76f8584e49cf7eedaa2e1312593bf46c7225d79a)

12 months agolinux(4): Fix arm64 build after b7a6bcdd, missed chunk added
Dmitry Chagin [Sat, 22 Apr 2023 22:41:12 +0000 (01:41 +0300)]
linux(4): Fix arm64 build after b7a6bcdd, missed chunk added

MFC after: 1 month

(cherry picked from commit 66e8f1f7d37b5f657086437f5411a63c9080e25c)

12 months agolinux(4): Bump osrelease to 5.15.0
Dmitry Chagin [Sat, 22 Apr 2023 19:18:08 +0000 (22:18 +0300)]
linux(4): Bump osrelease to 5.15.0

Linux kernel version 5.15 named Trick or Treat is a 22nd LTS release.

Reviewed by: trasz, emaste
Differential Revision: https://reviews.freebsd.org/D39649
MFC after: 1 month

(cherry picked from commit 0ef30b5d6b75596e087a86c3cb01a0b2c611e7e6)

12 months agolinux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:52 +0000 (22:17 +0300)]
linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata

AT_MINSIGSTKSZ has appeared in the 5.13.0 Linux kernel first time.

Differential Revision: https://reviews.freebsd.org/D39648
MFC after: 1 month

(cherry picked from commit b7a6bcdd1319b4e5da0bfc5e7790cbf26efe9892)

12 months agolinux(4): Export the AT_EXECFN depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:36 +0000 (22:17 +0300)]
linux(4): Export the AT_EXECFN depending on the process osreldata

AT_EXECFN has appeared in the 2.6.26 Linux kernel first time.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39647
MFC after: 1 month

(cherry picked from commit 70eab81d6ffecf0ba4c7f19a8b6389178eda5259)

12 months agolinux(4): Export the AT_RANDOM depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:17 +0000 (22:17 +0300)]
linux(4): Export the AT_RANDOM depending on the process osreldata

AT_RANDOM has appeared in the 2.6.30 Linux kernel first time.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39646
MFC after: 1 month

(cherry picked from commit 40c36c4674eb9602709cf9d0483a4f34ad9753f6)

12 months agolinux(4): Fix LINUX_AT_COUNT comments
Dmitry Chagin [Sat, 22 Apr 2023 19:16:43 +0000 (22:16 +0300)]
linux(4): Fix LINUX_AT_COUNT comments

Differential Revision: https://reviews.freebsd.org/D39645
MFC after: 1 month

(cherry picked from commit 56c5230afdcf2b317d904009abe577e91b382542)

12 months agolinux(4): Deduplicate linux_copyout_auxargs()
Dmitry Chagin [Sat, 22 Apr 2023 19:16:02 +0000 (22:16 +0300)]
linux(4): Deduplicate linux_copyout_auxargs()

Export default MINSIGSTKSZ value for the x86 until we do not preserve AVX
registers in the signal context.

Differential Revision: https://reviews.freebsd.org/D39644
MFC after: 1 month

(cherry picked from commit 7d8c98398302b939b97310d31883ebdab8c0b938)

12 months agolinux(4): Regen for close_range syscall
Dmitry Chagin [Tue, 4 Apr 2023 20:23:37 +0000 (23:23 +0300)]
linux(4): Regen for close_range syscall

MFC after: 2 weeks

(cherry picked from commit 50111714f5a46add66264d48456c32b7d3d0036a)

12 months agolinux(4): Modify close_range syscall to match Linux
Dmitry Chagin [Tue, 4 Apr 2023 20:23:24 +0000 (23:23 +0300)]
linux(4): Modify close_range syscall to match Linux

MFC after: 2 weeks

(cherry picked from commit 1c27dce1f8979e7bbe3ca51f4f2db38b202042a0)

12 months agopseudofs: Simplify pfs_visible_proc
Dmitry Chagin [Sun, 2 Apr 2023 08:24:10 +0000 (11:24 +0300)]
pseudofs: Simplify pfs_visible_proc

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39383
MFC after: 1 month

(cherry picked from commit a32ed5ec05d9bc01b8e70b45ff510d2f972a0877)

12 months agopseudofs: Allow vis callback to be called for a named node
Dmitry Chagin [Sun, 2 Apr 2023 08:21:15 +0000 (11:21 +0300)]
pseudofs: Allow vis callback to be called for a named node

This will be used later in the linsysfs module to filter out VNETs.

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39382
MFC after: 1 month

(cherry picked from commit 405c0c04edb6143405426da6a5273f4c5998d594)

12 months agopseudofs: Microoptimize struct pfs_node
Dmitry Chagin [Sun, 2 Apr 2023 08:20:07 +0000 (11:20 +0300)]
pseudofs: Microoptimize struct pfs_node

Since 81167243b the size of struct pfs_node is 280 bytes, so the kernel
memory allocator takes memory from 384 bytes sized bucket. However, the
length of the node name is mostly short, e.g., for Linux emulation layer
it is up to 16 bytes. The size of struct pfs_node w/o pfs_name is 152
bytes, i.e., we have 104 bytes left to fit the node name into the 256
bytes-sized bucket.

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39381
MFC after: 1 month

(cherry picked from commit 7f72324346ea154a92671fc913dbe82c0287501a)

12 months agolinsysfs(4): Keep Linux compatible sysfs the same as Ubuntu
Vico Chen [Sat, 25 Mar 2023 10:41:04 +0000 (13:41 +0300)]
linsysfs(4): Keep Linux compatible sysfs the same as Ubuntu

By checking Ubuntu, there is no `/sys/subsystem' in sysfs. To compatible
with Ubuntu, delete the 'subsystem' creation in Linux compatible module.

On the other hand, the sysfs `/sys/subsystem' cause failure for some
Linux udev cases. In Linux udev source code, there is a function named
`scan_devices_all', and it will scan `/sys/subsystem' if it is existed,
but now there are nothing in /sys/subsystem `, and it returns empty
to cause some use cases failed.

Reviewed by: dchagin
Differential Revision: https://reviews.freebsd.org/D38885
MFC after: 1 month
XMFC with: ifAPI

(cherry picked from commit 1f0c8bfd650422a30aa6fcf01da860b8d43628a8)

12 months agoApply llvm fix for hanging gcc builds on 32-bit arm
Dimitry Andric [Mon, 19 Jun 2023 18:32:40 +0000 (20:32 +0200)]
Apply llvm fix for hanging gcc builds on 32-bit arm

Merge commit 962c306a11d0 from llvm-project (by Florian Hahn):

  [LV] Don't consider pointer as uniform if it is also stored.

  Update isVectorizedMemAccessUse to also check if the pointer is stored.
  This prevents LV to incorrectly consider a pointer as uniform if it is
  used as both pointer and stored by the same StoreInst.

  Fixes #61396.

PR: 271992
Reported by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

(cherry picked from commit dbbaf77801a8f30e49731395e85757f339f345bf)

12 months agonetinet: re-read IP length after PFIL hook
Kristof Provost [Fri, 2 Jun 2023 14:38:30 +0000 (16:38 +0200)]
netinet: re-read IP length after PFIL hook

The pfil hook may modify the packet, so before we check its length (to
decide if it needs to be fragmented or not) we should re-read that
length.

This is most likely to happen when pf is reassembling packets. In that
scenario we'd receive the last fragment, which is likely to be a short
packet, pf would reassemble it (likely exceeding the interface MTU) and
then we'd transmit it without fragmenting, because we're comparing the
MTU to the length of the last fragment, not the fully reassembled
packet.

See also: https://redmine.pfsense.org/issues/14396
Reviewed by: cy
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40395

(cherry picked from commit 185c1cddd7ef34db82bc3a25b3c92556416a4e55)

12 months agopcib: Allocate the memory BAR with the MSI-X table.
John Baldwin [Mon, 19 Jun 2023 16:15:48 +0000 (09:15 -0700)]
pcib: Allocate the memory BAR with the MSI-X table.

This is required for pci_alloc_msix() to work and to thus use
MSI-X interrupts for PCI-e hotplug.

Reported by: cperciva
Reviewed by: cperciva
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40581

(cherry picked from commit e6b838363fb473b5e35a8ae6a1da5e15f5b52960)

12 months ago<sys/cdefs.h>: Decay expression passed to fallback version of __generic()
John Baldwin [Fri, 27 Jan 2023 00:28:22 +0000 (16:28 -0800)]
<sys/cdefs.h>: Decay expression passed to fallback version of __generic()

This ensures that __generic() more closely matches _Generic() when
using the fallback version when _Generic() is not available (such as
GCC).

Co-authored by: jrtc27
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D38215

(cherry picked from commit 9d2f9798175586bdcd3423443804fbbc0cffb8d2)

12 months agoether_demux: Defer stripping the Ethernet header.
John Baldwin [Wed, 30 Nov 2022 22:38:51 +0000 (14:38 -0800)]
ether_demux: Defer stripping the Ethernet header.

This avoids having to undo it before invoking NetGraph's orphan input
hook.

Reviewed by: ae, melifaro
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37510

(cherry picked from commit 79b679942352a7f10d759fdee1892aa251e0f439)

12 months agosystat: Fix a bunch of use after frees in fetch_ifstat().
John Baldwin [Tue, 22 Nov 2022 19:11:42 +0000 (11:11 -0800)]
systat: Fix a bunch of use after frees in fetch_ifstat().

I think this was probably just a typo.  initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by: GCC 12 -Wuse-after-free
Differential Revision: https://reviews.freebsd.org/D36823

(cherry picked from commit f6fdf9214a657351e78c68aac1888e674c0481f6)

12 months agotop(8): restore erronously removed SWAIT array element
Konstantin Belousov [Wed, 21 Jun 2023 05:43:11 +0000 (08:43 +0300)]
top(8): restore erronously removed SWAIT array element

(cherry picked from commit 5bd5470a2c975b8d3c841a68ac66bd0a3acdf966)

12 months agotop(8): add missed SLOCK state to the sorted_state[]
Konstantin Belousov [Mon, 19 Jun 2023 16:00:15 +0000 (19:00 +0300)]
top(8): add missed SLOCK state to the sorted_state[]

(cherry picked from commit 6a5e6a50bd55c3fb4933abe1edaad3a928700c42)

12 months agotop(8): document the actual sort order for process sorting
Konstantin Belousov [Mon, 19 Jun 2023 15:57:00 +0000 (18:57 +0300)]
top(8): document the actual sort order for process sorting

(cherry picked from commit d636fc5bd1e218d2eb4d017b93ee59f5db5c8507)

12 months agotop(8): use designated initializers for sorted_state[]
Konstantin Belousov [Mon, 19 Jun 2023 13:52:05 +0000 (16:52 +0300)]
top(8): use designated initializers for sorted_state[]

(cherry picked from commit bc2ac2585aa89c110861972aeb243719ea5012b8)

12 months agotop(8): designate the sorted_state[] array as constant
Konstantin Belousov [Mon, 19 Jun 2023 13:49:19 +0000 (16:49 +0300)]
top(8): designate the sorted_state[] array as constant

(cherry picked from commit 5c6393451f58c4e6c92410ae66e28c899bfacdb9)

12 months agoe1000: Add SPDX tag to em_txrx
Kevin Bowling [Fri, 9 Jun 2023 01:42:20 +0000 (18:42 -0700)]
e1000: Add SPDX tag to em_txrx

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D30072

(cherry picked from commit 034f38cdf864e6794fd63b67bf16c59627576699)

12 months agoe1000: Format em_txrx
Kevin Bowling [Fri, 9 Jun 2023 02:06:04 +0000 (19:06 -0700)]
e1000: Format em_txrx

No functional changes intended.

Reviewed by: markj (prior version)
Differential Revision: https://reviews.freebsd.org/D30072

(cherry picked from commit 5253d74e4650300815af351cc510a1c392a16584)

12 months agocap_net.3: fix typo
Shawn Webb [Wed, 21 Jun 2023 00:47:19 +0000 (20:47 -0400)]
cap_net.3: fix typo

Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>

12 months agobhyve: Include vmm.h via the usual path
Mark Johnston [Thu, 8 Jun 2023 21:25:25 +0000 (17:25 -0400)]
bhyve: Include vmm.h via the usual path

No functional change intended.

MFC after: 1 week
Sponsored by: Innovate UK

(cherry picked from commit 1da1a2643649ef83a5ddb2df16010dd2a48c1347)

12 months agohwpstate_amd: calculate power if P-state info comes from MSR
Johannes Totz [Mon, 12 Jun 2023 16:00:15 +0000 (12:00 -0400)]
hwpstate_amd: calculate power if P-state info comes from MSR

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40140

(cherry picked from commit e74dd9577fb00518834a1bf07fad8c1d4c978d7a)

12 months agobhyve: Remove some unneeded includes of segments.h
Mark Johnston [Thu, 8 Jun 2023 21:24:45 +0000 (17:24 -0400)]
bhyve: Remove some unneeded includes of segments.h

They are not needed and are specific to x86.  No functional change
intended.

MFC after: 1 week
Sponsored by: Innovate UK

(cherry picked from commit 6d1dfc87416f451164e79ebdc4a0fb53b001bfd9)

12 months agox86: Add defines for a couple of thermal and PM bits
Mark Johnston [Mon, 19 Jun 2023 17:26:07 +0000 (13:26 -0400)]
x86: Add defines for a couple of thermal and PM bits

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e60316d1eac91000e187ae248839fca31143090c)

12 months agoseq: fix check for rounding error/truncation
Ed Maste [Mon, 19 Jun 2023 01:37:06 +0000 (21:37 -0400)]
seq: fix check for rounding error/truncation

Based on OpenBSD 30f0fd29ba6c:
> We need to compare the printable version of the last value displayed,
> not the floating point representation.  Otherwise, we may print the
> last value twice.

PR: 271964
Reported by: Daniel Kolesa
Reviewed by: yuripv
Obtained from: OpenBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40601

(cherry picked from commit e54db9a9ccd588f650a2e57bf9d1cbbafc0e12eb)

12 months agoseq: fix style nits
Mariusz Zaborski [Fri, 30 Sep 2022 17:38:34 +0000 (19:38 +0200)]
seq: fix style nits

MFC after: 2 weeks

(cherry picked from commit 6da5e5d649ba255d41318daccc24e7af6984e0b1)

12 months agoseq: fix potential NULL ptr reference
Mariusz Zaborski [Fri, 30 Sep 2022 17:36:04 +0000 (19:36 +0200)]
seq: fix potential NULL ptr reference

asprintf(3) allocates memory, and there isn't any guarantee of success.

MFC after: 2 weeks
Obtained from:  OpenBSD

(cherry picked from commit 94c4f663bab58ec07584786dd76866011d5b2506)

12 months agoBump __FreeBSD_version to 1302506 for merges of LinuxKPI changes.
Bjoern A. Zeeb [Mon, 26 Jun 2023 12:05:50 +0000 (12:05 +0000)]
Bump __FreeBSD_version to 1302506 for merges of LinuxKPI changes.

Sponsored by: The FreeBSD Foundation

12 months agonet80211: fail for unicast traffic without unicast key
domienschepers [Thu, 10 Nov 2022 00:00:00 +0000 (00:00 +0000)]
net80211: fail for unicast traffic without unicast key

Falling back to the multicast key may cause unicast traffic to leak.
Instead fail when no key is found.

For more information see the 'Framing Frames: Bypassing Wi-Fi Encryption
by Manipulating Transmit Queues' paper.

[ I updated the commit message to reference the paper and the code
comment to record historic behaviour as discussed in private email. ]

(cherry picked from commit 61605e0ae5d8f34b89b8e71e393f3006f511e86a)

12 months agoLinuxKPI: 802.11: initialize txq
Bjoern A. Zeeb [Sat, 10 Jun 2023 22:18:38 +0000 (22:18 +0000)]
LinuxKPI: 802.11: initialize txq

In 5a9a0d7803382321b5f9fff1deae5fb08463cf1a we omitted the initialization
of the per-hw txq settings.  Fix this.

Sponsored by: The FreeBSD Foundation
Fixes: 5a9a0d7803382321b5f9fff1deae5fb08463cf1a

(cherry picked from commit a5ae63edd59453f23d51a0cc61922bd3e1e4cce4)

12 months agoLinuxKPI: 802.11: improve scan handling
Bjoern A. Zeeb [Sat, 10 Jun 2023 21:53:56 +0000 (21:53 +0000)]
LinuxKPI: 802.11: improve scan handling

Under certain circumstances a hw_scan may be downgraded to a software
scan.  Handle these situations better and make sure we free resources
in all cases once. [1]

Also leave a note about scanning all bands (or we would have to switch
bands manually).

In both cases hardware doing and driver saying seem not entirely
consistent for all and all firmware.

Sponsored by: The FreeBSD Foundation
Reported by: imp [1]

(cherry picked from commit 3206587a20de9810b549ba8fd0032f7ab884bbec)

12 months agoLinuxKPI: 802.11: correct HE_MAC_CAP3 values
Bjoern A. Zeeb [Sat, 10 Jun 2023 22:56:03 +0000 (22:56 +0000)]
LinuxKPI: 802.11: correct HE_MAC_CAP3 values

While we had assigned dummy values so far to HE, correct the HW_MAC_CAP3
values to avoid compile time errors of drivers when shifting values out
of range.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 51117ed11640e40e877872065ea039e9f97a9cd0)

12 months agoLinuxKPI: implement timer_{delete,shutdown}_sync()
Bjoern A. Zeeb [Tue, 16 May 2023 21:02:03 +0000 (21:02 +0000)]
LinuxKPI: implement timer_{delete,shutdown}_sync()

Implement timer_{delete,shutdown}_sync(), which do not seem to require
anything additional to the already existing del_timer_sync().

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40124

(cherry picked from commit 2e07e885d65973f13d6111f7e0fcfb848a68082e)

12 months agoLinuxKPI: add devm_ioremap()
Bjoern A. Zeeb [Sat, 20 May 2023 00:53:21 +0000 (00:53 +0000)]
LinuxKPI: add devm_ioremap()

Given we do not seem to support ioremap() do not support the "devm"
version either and simply return NULL, which means we do not have
to keep track of the memory to be freed on device free later.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40173

(cherry picked from commit 4cbd427788ec625f17c1ecdfccbb7b06c1c908d9)

12 months agoLinuxKPI: Add linux/stddef.h and add struct_group(...)
Bjoern A. Zeeb [Wed, 17 May 2023 22:22:13 +0000 (22:22 +0000)]
LinuxKPI: Add linux/stddef.h and add struct_group(...)

Merge the original addition of stddef.h.

(cherry picked from commit 7c7419f60cafa4f666f5a22b5e5f090081516cd2)

Add a struct_group() macro needed by a wireless driver.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40138

(cherry picked from commit 7c0c69d1a0f3735e315a48436bffbd482f956270)

12 months agoLinuxKPI: add ktime_get_real_ts64()
Bjoern A. Zeeb [Tue, 23 May 2023 23:10:32 +0000 (23:10 +0000)]
LinuxKPI: add ktime_get_real_ts64()

Add a wrapper for ktime_get_real_ts64() used by a wireless driver.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40246

(cherry picked from commit b889315da3009256c5078e629a28763d981b70ad)

12 months agoLinuxKPI: add dummy rhashtable implementation
Bjoern A. Zeeb [Sat, 20 May 2023 00:45:47 +0000 (00:45 +0000)]
LinuxKPI: add dummy rhashtable implementation

Add a skeleton implementation of rhashtable in order to keep an
upcoming wireless driver compiling.  We'll implement it as soon as
we get there.

Reviewed by: emaste (previous version before his suggested changes)
Differential Revision: https://reviews.freebsd.org/D40176

(cherry picked from commit a30a0d940daef2df51371cf142790109e2019fa0)

12 months agoLinuxKPI: uuid: add guid_gen() and guid_copy()
Bjoern A. Zeeb [Tue, 23 May 2023 23:15:12 +0000 (23:15 +0000)]
LinuxKPI: uuid: add guid_gen() and guid_copy()

Add function used by a wireless driver.

Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40249

(cherry picked from commit c1b6e9121e889608b86530d1a37047797dfeb460)

12 months agoLinuxKPI: add utsname for init_utsname() with release
Bjoern A. Zeeb [Tue, 23 May 2023 23:12:47 +0000 (23:12 +0000)]
LinuxKPI: add utsname for init_utsname() with release

A wireless dirver is requesting release from the result of
init_utsname().  Populate the field on startup.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40248

(cherry picked from commit ad513b4dba3e330b6f2714bdde4d864898c4222e)

12 months agoLinuxKPI: pci: update struct msi_desc
Bjoern A. Zeeb [Sat, 20 May 2023 00:48:28 +0000 (00:48 +0000)]
LinuxKPI: pci: update struct msi_desc

It seems struct msi_desc is setup differently (or was changed) compared
to how we added it a while ago.  Catch up in order to keep drivers
directly accessing fields compiling.

Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40175

(cherry picked from commit 17bde9cbc6fc3ac219aa11243c0b75025786f628)

12 months agoLinuxKPI: pci: add PCI_COMMAND_MEMORY
Bjoern A. Zeeb [Tue, 23 May 2023 23:11:06 +0000 (23:11 +0000)]
LinuxKPI: pci: add PCI_COMMAND_MEMORY

Add another PCI alias to our native defines for a wireless driver.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40247

(cherry picked from commit 7d7d12ba7765902f51dabb259a186ca3b1a2d351)

12 months agoLinuxKPI: implement pci_rescan_bus()
Bjoern A. Zeeb [Tue, 16 May 2023 20:59:30 +0000 (20:59 +0000)]
LinuxKPI: implement pci_rescan_bus()

Try to implement pci_rescan_bus().  pci_rescan_method() is already
doing most of the job.  We only have to do the count for the return
value again ourselves.

Sponsored by: The FreeBSD Foundation
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D40122

(cherry picked from commit 525dd4acaacc59b815131caccfdebc905d4d7bff)

12 months agoLinuxKPI: add further dummy header files
Bjoern A. Zeeb [Sat, 20 May 2023 00:41:45 +0000 (00:41 +0000)]
LinuxKPI: add further dummy header files

Wireless drivers try to include these files.  Add them empty for no
better reason yet.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b7afaf8a411a0536691feabb024ffd5afb579eb5)
(cherry picked from commit 6a1c5037363aebd14333bb759237d2b19a1608d8)
(cherry picked from commit ab55b58b5c515148e6ef65422c9fda17085f07cd)

12 months agoath10k: ath11k: add specific LinuxKPI support
Bjoern A. Zeeb [Tue, 18 Apr 2023 20:21:37 +0000 (20:21 +0000)]
ath10k: ath11k: add specific LinuxKPI support

Add files needed by ath1?k drivers to linuxkpi/linuxkpi_wlan.
This contain (skeleton) implementations of what is needed to
compile but specifically mhi/qmi/qrtr will need more work for
ath11k.

(cherry picked from commit 06a1103fe38677ba6213cae321255f53e9476dcd)
(cherry picked from commit 047298203fc3bc2b290f44b9531a7b7d553fe9b7)
(cherry picked from commit bee50f894b9e0b51668c83e24bf2ec7c275725eb)

12 months agoLinuxKPI: netdevice: add dev_set_threaded()
Bjoern A. Zeeb [Sat, 20 May 2023 00:51:01 +0000 (00:51 +0000)]
LinuxKPI: netdevice: add dev_set_threaded()

Add dev_set_threaded() to the dummy functions of netdevice.h in order
to keep an upcoming wireless driver compiling.
While here also update the name of a function argument for consistency.

(cherry picked from commit 6153bef9ec961786d79c52e51c6908324661e26e)

12 months agoLinuxKPI: add put_unaligned_le16() and get_unaligned_be64()
Bjoern A. Zeeb [Sat, 20 May 2023 00:52:27 +0000 (00:52 +0000)]
LinuxKPI: add put_unaligned_le16() and get_unaligned_be64()

Add the two new functions needed by wireless drivers by the same
implementation pattern we did for different sizes.

Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40174

(cherry picked from commit ae1e336e05171b80123bf6db7457f19c174accc4)

12 months agoLinuxKPI: add ns_to_timespec64()
Bjoern A. Zeeb [Tue, 16 May 2023 21:00:45 +0000 (21:00 +0000)]
LinuxKPI: add ns_to_timespec64()

Add ns_to_timespec64() which does not seem to require anything from
us given timespec64 is aliases to timespec.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40123

(cherry picked from commit 71fde8e5070c4128e35acdb7f69a01460bce4638)

12 months agoLinuxKPI: skbuff.h: add more (skeleton) functions used by wireless drivers
Bjoern A. Zeeb [Tue, 16 May 2023 21:22:34 +0000 (21:22 +0000)]
LinuxKPI: skbuff.h: add more (skeleton) functions used by wireless drivers

Add a dummy skb_hwtstamps() function for now, and implement
skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header().

Add a dummy implementation of skb_get_hash() until we'll hit and
implement it.  Add napi_build_skb() and skb_mark_for_recycle().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 262c5e81937ff1682632f33e92c3e42bc92e5a77)
(cherry picked from commit 369264acf7d2a317383599141ab2f36ee3d2130c)
(cherry picked from commit 1213a6bea8a16dc797efea5a7ed7d6a4d7cb4675)

12 months agoLinuxKPI: add ptp_clock_kernel.h
Bjoern A. Zeeb [Tue, 16 May 2023 21:24:08 +0000 (21:24 +0000)]
LinuxKPI: add ptp_clock_kernel.h

Add the new ptp_clock_kernel.h with structs and dummy functions for
kernel ptp support.  This is needed for the next iwlwifi update.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 972bf40b62f7de0a4c652e4577c551200dfe45a5)

12 months agoLinuxKPI: add dummy hash.h and kernel_connect()
Bjoern A. Zeeb [Thu, 11 May 2023 22:19:57 +0000 (22:19 +0000)]
LinuxKPI: add dummy hash.h and kernel_connect()

Add crypto/hash.h and a dummy kernel_connect() needed to compile
the ath11k wireless driver.  While I hope we will not actually need
the hash.h fallbacks, kernel_connect() we will have to deal with once
we sort out more QMI bits.

(cherry picked from commit d544b53cb0b6bc25f2ba078bd9c07e611095bf29)

12 months agoLinuxKPI: 802.11: fix IEEE80211_TX_INFO_DRIVER_DATA_SIZE
Bjoern A. Zeeb [Thu, 11 May 2023 21:35:11 +0000 (21:35 +0000)]
LinuxKPI: 802.11: fix IEEE80211_TX_INFO_DRIVER_DATA_SIZE

Fix the sizing of IEEE80211_TX_INFO_DRIVER_DATA_SIZE so that it
also works on 32bit platforms.  Otherwise it triggers a compile-time
assertion in ath10k for i386.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 910a834383587fc6630225200cc66b7965d5102f)

12 months agoLinuxKPI: pci.h: always initialize return value
Bjoern A. Zeeb [Thu, 20 Apr 2023 15:59:33 +0000 (15:59 +0000)]
LinuxKPI: pci.h: always initialize return value

In pcie_capability_read_*() always initialize the return value to
avoid warnings of uninitialized values in callers.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39721

(cherry picked from commit 0e8953b94b7481a53945cbd1e16517773996e16e)

12 months agoLinuxKPI: 802.11: improve assertion and tkip code
Bjoern A. Zeeb [Thu, 20 Apr 2023 16:01:05 +0000 (16:01 +0000)]
LinuxKPI: 802.11: improve assertion and tkip code

Move a KASSERT out of a function and make it a CTASSERT with
appropriate comments.

Skeleton implement two tkip functions, still left TODO, initializing
variables with dummy values to quiten compiler warnings.  It is
unclear to me if we should still ever properly implement TKIP
compat code at this point.  If so the current code gives a good
idea what needs to be done in addition to allocating references
to real state along with keyconf.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 35f7fa4ac1aea8af9a4f2428b3f0a346151b4071)

12 months agoLinuxKPI: 802.11: adjust locking
Bjoern A. Zeeb [Fri, 31 Mar 2023 19:52:19 +0000 (19:52 +0000)]
LinuxKPI: 802.11: adjust locking

Split up the lhw lock and the scan lock.  The latter is a mtx
while the former changes from mtx to sx as mac80211 downcalls may
sleep (and the ic lock is not usable in that case either and a larger
project to fix).
This will also enforce some lookups under lock (mostly scan) as well
as general protection for more compat code and avoid a possible
deadlock with one of the upcoming callbacks from driver into the
compat code.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8ac540d3b8bf9746216c4687b4629296357cf146)

12 months agoLinuxKPI: 802.11: remove extra spaces
Bjoern A. Zeeb [Sun, 2 Apr 2023 22:25:28 +0000 (22:25 +0000)]
LinuxKPI: 802.11: remove extra spaces

Remove two extra spaces.  No functional change.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit cfccc7f30a01bb6f00672e4be4abfe4107d645bb)

12 months agoLinuxKPI: 802.11: use ic_printf more consistently
Bjoern A. Zeeb [Fri, 31 Mar 2023 07:10:37 +0000 (07:10 +0000)]
LinuxKPI: 802.11: use ic_printf more consistently

Rather than printing ic_name ourselves (or not at all) use ic_printf()
as a common function from net80211 where possible.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3f0083c4e30ab41fad1e93e4138767df42dbdf20)

12 months agonet80211: Radiotap: update for newer standards (add EHT, U-SIG)
Bjoern A. Zeeb [Tue, 16 May 2023 16:03:17 +0000 (16:03 +0000)]
net80211: Radiotap: update for newer standards (add EHT, U-SIG)

iwlwifi already uses suggested EHT and U-SIG bits as well as some
more TLV bits.  Update radiotap to know of those even if they might
get updated again in the future in order to get newer versions of
the driver to compile.

ath1xk drivers require further HE defines.  Some of those we had
already predicted as comments in the past.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7232e6dcc89b978825b30a537bca2e7d3a9b71bb)
(cherry picked from commit 63231f4d5bae5fbdb2ebbca4860416557c397059)

12 months agoLinuxKPI: fix WRITE_ONCE()
Bjoern A. Zeeb [Sat, 13 May 2023 15:17:47 +0000 (15:17 +0000)]
LinuxKPI: fix WRITE_ONCE()

Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c63b28de1d590dc42502fbe959a6da2e which
fixed READ_ONCE().

Sponsored by: The FreeBSD Foundation
Suggested by: jhb
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40084

(cherry picked from commit 046d8d89ed1956944b12ec4f0580c30bc202bbfb)

12 months agoLinuxKPI: fix READ_ONCE() -Wcast-equal warnings
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:43:59 +0000 (21:43 +0000)]
LinuxKPI: fix READ_ONCE() -Wcast-equal warnings

Rather than using ACCESS_ONCE() in READ_ONCE() add a missing cast
to const in order to satisfy -Wcast-equal by gcc.
Sadly we cannot do the same to WRITE_ONCE() which still is very
noisy.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D39706

(cherry picked from commit 74e908b3c63b28de1d590dc42502fbe959a6da2e)

12 months agoLinuxKPI: skbuff.h: fix -Warray-bounds warnings
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:37:01 +0000 (21:37 +0000)]
LinuxKPI: skbuff.h: fix -Warray-bounds warnings

Harmonize sk_buff_head and sk_buff further and fix -Warray-bounds
warnings reports by gcc.  At the same time simplify some code by
re-using other functions or factoring some code out.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b2dcb848688e1e8346762531208dd7d468ff3854)

12 months agoLinuxKPI: 802.11: fix a -Wenum-compare warning
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:40:18 +0000 (21:40 +0000)]
LinuxKPI: 802.11: fix a -Wenum-compare warning

We are asserting that two values from different enums are the same.
gcc warns about these.  Cast the values to (int) to avoid the warning.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f369f10dd8122b1cd1282a378fb16ba81a712a74)

12 months agoiwlwifi: quieten more compiler warnings
Bjoern A. Zeeb [Thu, 20 Apr 2023 15:57:14 +0000 (15:57 +0000)]
iwlwifi: quieten more compiler warnings

Quieten some more (valid) gcc warnings and disable dead code.
There are more warnings, some probably a compiler problem, the
other related to firmware structs which I do not want to adjust
just locally.  Leave a comment to revisit after a next driver
update.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7db7bfe1a7b95c1acfc7861e05ee8808d448715f)

12 months agoiwlwifi: rtw88: rtw89: fix gcc warnings
Bjoern A. Zeeb [Tue, 18 Apr 2023 19:51:09 +0000 (19:51 +0000)]
iwlwifi: rtw88: rtw89: fix gcc warnings

Fix -Wno-format and unused variables warnings with gcc by adopting
(to|the) FreeBSD-specific code.

Reported by: jhb
Sponsored by: The FreeBSD Foundation
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D39673

(cherry picked from commit f621b087c00776de713944ae6561e44f83e7b541)

12 months agortw89: fix -Wunused-but-set-variable
Bjoern A. Zeeb [Thu, 23 Mar 2023 00:29:38 +0000 (00:29 +0000)]
rtw89: fix -Wunused-but-set-variable

Fix a -Wunused-but-set-variable warning by adding the field to the
debug logging as is done for other versions handler functions.

(cherry picked from commit 700acdc7b53213c1d9f35c05a1c1f58f285cd14d)

12 months agoKASAN: add bus_space*read*_8 for aarch64
Bjoern A. Zeeb [Sat, 15 Apr 2023 15:35:50 +0000 (15:35 +0000)]
KASAN: add bus_space*read*_8 for aarch64

Add the remaining bus_space*read*_8 functions conditionally for
only arm64 in order to not break KASAN builds with new code using
one of them.

Suggested by: markj
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D39581

(cherry picked from commit 42742fe725102a73b09800f4d041ad69b5d81edb)

12 months agoman4: fix some mandoc lint for iwlwifi.4 and rtw88.4
Bjoern A. Zeeb [Sun, 23 Apr 2023 13:21:46 +0000 (13:21 +0000)]
man4: fix some mandoc lint for iwlwifi.4 and rtw88.4

Address warnings (but one) from mandoc -T lint for these man pages.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b95fa4203d698063b02b03647cd00906cd94687a)

12 months agoifconfig: improve trimming off interface number at end
Bjoern A. Zeeb [Wed, 17 May 2023 20:40:47 +0000 (20:40 +0000)]
ifconfig: improve trimming off interface number at end

When trying to auto-load a module, we trim the interface number off
the end.  Currently we stop at the first digit.  For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4).  For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by: The FreeBSD Foundation
Reported by: thierry
Reviewed by: melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137

(cherry picked from commit 2e6756b752e07878ae5f5e3e9b74934231f9fd17)

12 months agonetwork.subr: adjust regex for wlans_xxxxx rc.conf entries
Bjoern A. Zeeb [Tue, 18 Apr 2023 14:40:13 +0000 (14:40 +0000)]
network.subr: adjust regex for wlans_xxxxx rc.conf entries

Drivers like ath1[012]k will not match the current wlans_*-regex as
they have digits followed by letters.  Adjust the regex to allow
this combination in order to be able to configure interfaces with
names like wlans_ath11k0="..."

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39674

(cherry picked from commit de1dde5dfea4407119955a6f94528396b258db3f)

12 months agorc/WPA: driver_bsd.c: backout upstream IFF_ change and add logging
Bjoern A. Zeeb [Thu, 23 Mar 2023 22:37:12 +0000 (22:37 +0000)]
rc/WPA: driver_bsd.c: backout upstream IFF_ change and add logging

This reverts the state to our old supplicant logic setting or clearing
IFF_UP if needed.  In addition this adds logging for the cases in which
we do (not) change the interface state.

Depending on testing this seems to help bringing WiFi up or not log
any needed changes (which would be the expected wpa_supplicant logic
now).  People should look out for ``(changed)`` log entries (at least
if debugging the issue; this way we will at least have data points).

There is a hypothesis still pondered that the entire IFF_UP toggling
only exploits a race in net80211 (see further discssussions for more
debugging and alternative solutions see D38508 and D38753).
That may also explain why the changes to the rc startup script [1]
only helped partially for some people to no longer see the
continuous CTRL-EVENT-SCAN-FAILED.

It is highly likely that we will want further changes and until
we know for sure that people are seeing ''(changed)'' events
this should stay local.  Should we need to upstream this we'll
likely need #ifdef __FreeBSD__ around this code.

Remove ifconfig down/up workaround (bfb202c4554a) in
rc.d/wpa_supplicant as it is no longer needed.

[1] 5fcdc19a81115d975e238270754e28557a2fcfc5 and
    d06d7eb09131edea666bf049d6c0c55672726f76

Sponsored by: The FreeBSD Foundation
Reviewed by: cy, enweiwu (earlier)
Differential Revision: https://reviews.freebsd.org/D38807

(cherry picked from commit bfb202c4554a72383202a1a401d80721935b8c95)

Reviewed by: bz (for wireless)
Differential Revision: https://reviews.freebsd.org/D39257

(cherry picked from commit 052211e08c0e227277d0c4dc603bba2253eb3d73)

12 months agoifconfig: ifieee80211: print bssid name
Bjoern A. Zeeb [Tue, 21 Mar 2023 21:25:28 +0000 (21:25 +0000)]
ifconfig: ifieee80211: print bssid name

In certain setups (e.g., autonomous APs) it is extremly helpful to have
a way to map the BSSIDs to names for both normal status output as well
as the scan list.  This often allows a quicker overview than remembering
(or manually looking up) BSSIDs.
Call ether_ntohost() on the bssid and consult /etc/ethers
and print "(name)" after the bssid for the status output and "(name)"
at the end of the line after the IE list.

Reviewed by: adrian, cy
Differential Revision: https://reviews.freebsd.org/D39192

(cherry picked from commit e091be417add7e9130653462012a9ab2f4fb5269)

12 months agonet80211: define mask for ss_flags rather than using hardcoded 0xfff
Bjoern A. Zeeb [Tue, 14 Mar 2023 21:00:48 +0000 (21:00 +0000)]
net80211: define mask for ss_flags rather than using hardcoded 0xfff

scan state ss_flags in two places cut off the "internal" GOTPICK
options.  Replace the hardcoded 0xfff with a defined mask.
Note that "internal" flags is confusing as we also supplement the
the 16bit by another 16bit of "internal flags" passed around but
comaparing to GOTPICK never stored to my understanding.

No functional change.

Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D38832

(cherry picked from commit 3346164ce844f8995311c3988ab193bd6ddda0c9)

12 months agonet80211: make ieee80211_scan_dump_channels private
Bjoern A. Zeeb [Tue, 14 Mar 2023 21:01:19 +0000 (21:01 +0000)]
net80211: make ieee80211_scan_dump_channels private

ieee80211_scan_dump_channels() is only used locally and only when
IEEE80211_DEBUG is compiled.  Stop exporting it, make it file local
and hide under the #ifdef to reduce the footprint for production
kernels a tiny bit.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38833

(cherry picked from commit d7fb679dc96b07c38eedfa8c91817b44b214c799)

12 months agodpaa2: add console support for FDT based systems
Bjoern A. Zeeb [Tue, 14 Feb 2023 15:53:13 +0000 (15:53 +0000)]
dpaa2: add console support for FDT based systems

Add DPAA2 console support for MC and AIOP (latter untested) for FDT
systems.  ACPI systems are prepared but need some proper bus function
in order to get the address from MC (and likely a file splitup then).
This will come at a later stage once other ACPI/FDT bus parts are
cleared up.
The work was originally done in July 2022 and finally switched to
bus_space[1] lately to be ready for main.

Suggested by: andrew [1]
Reviewed by: dsl
Differential Revision: https://reviews.freebsd.org/D38592

(cherry picked from commit 72ef722b2a34b8f94fd639b05881242686480f05)

12 months agomotd: MFC: unbreak for source upgrade
Eugene Grosbein [Mon, 19 Jun 2023 07:49:35 +0000 (14:49 +0700)]
motd: MFC: unbreak for source upgrade

In case of source upgrade path from 12.x proper merge of new /etc
installs /etc/motd.template. Becase of that, the system is left
without symlink /etc/motd -> /var/run/motd but with stale /etc/motd contents.

Fix it creating symlink despite of presence of /etc/motd.template.

(cherry picked from commit 79a96e294c1acb4a2d17447a35f08647a6d09978)

12 months agosctp: only start shutdown guard timer when sending SHUTDOWN chunk
Michael Tuexen [Wed, 3 May 2023 18:28:46 +0000 (20:28 +0200)]
sctp: only start shutdown guard timer when sending SHUTDOWN chunk

The intention is to protect a malicious peer not following the
shutdown procedures.

(cherry picked from commit 04ede3675e44847c3e9e4a9bd44509cdf42ed60a)

12 months agosctp: improve shutdown(..., SHUT_WR) handling
Michael Tuexen [Wed, 3 May 2023 15:30:50 +0000 (17:30 +0200)]
sctp: improve shutdown(..., SHUT_WR) handling

When shutdown(..., SHUT_WR) is called in the front states, send a
SHUTDOWN chunk when a COOKIE ACK chunk is received and there is
no outstanding data.

(cherry picked from commit d9ae4adff2715cfab4a941037ec15aa07108efa1)

12 months agosctp: improve handling of stale cookie error causes
Michael Tuexen [Sun, 30 Apr 2023 09:39:32 +0000 (11:39 +0200)]
sctp: improve handling of stale cookie error causes

* If a measure of staleness of 0 is reported, use the RTT instead.
* Ensure that we always send a cookie preservative parameter by
  rounding up during the calculation.
* If allowed, perform a round trip time measurement.
* Clear the overall error counter, since the error cause also
  acts like an ACK.

(cherry picked from commit 1f0e13449beef3a983d9ed2faf4734075e4120d1)

12 months agosctp: use constants from RFC 8260 to improve compliance
Michael Tuexen [Sun, 23 Apr 2023 15:48:05 +0000 (17:48 +0200)]
sctp: use constants from RFC 8260 to improve compliance

Keep the old constants for backwards compatibility.

(cherry picked from commit 66d6fd532282fda0cda0ca31d93ff09044f1386a)

12 months agosctp: enforce Kahn's rule during the handshake
Michael Tuexen [Thu, 16 Mar 2023 16:40:40 +0000 (17:40 +0100)]
sctp: enforce Kahn's rule during the handshake

Don't take RTT measurements on packets containing INIT or COOKIE-ECHO
chunks, when they were retransmitted.

(cherry picked from commit 8ed1e2c88012cfca9fc4131a2637452cc9106b81)

12 months agosctp: don't do RTT measurements with cookies
Michael Tuexen [Thu, 16 Mar 2023 09:45:13 +0000 (10:45 +0100)]
sctp: don't do RTT measurements with cookies

When receiving a cookie, the receiver does not know whether the
peer retransmitted the COOKIE-ECHO chunk or not. Therefore, don't
do an RTT measurement. It might be much too long.
To overcome this limitation, one could do at least two things:
1. Bundle the INIT-ACK chunk with a HEARTBEAT chunk for doing the
   RTT measurement. But this is not allowed.
2. Add a flag to the COOKIE-ECHO chunk, which indicates that it
   is the initial transmission, and not a retransmission. But
   this requires an RFC.

(cherry picked from commit c91ae48a25edd426efc49ade14fb675e07a0f5ed)

12 months agotcp: fix TCP MD5 computation for the BBR and RACK stack
Michael Tuexen [Wed, 21 Jun 2023 20:54:33 +0000 (22:54 +0200)]
tcp: fix TCP MD5 computation for the BBR and RACK stack

PR: 253096
Reviewed by: cc, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D40597

(cherry picked from commit 02b885b09d1e90574162a1442b9ede06cef2b13a)

12 months agotcp: fix TCP MD5 digest computation for TCP over UDP
Michael Tuexen [Wed, 21 Jun 2023 20:48:12 +0000 (22:48 +0200)]
tcp: fix TCP MD5 digest computation for TCP over UDP

Skip the UDP header for the computation. This is similar to
skipping IPv6 extension headers.

Reviewed by: cc, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D40596

(cherry picked from commit 0fb0711dba76a32a2202d2f41d64aa1247b5e51d)

12 months agosctp: fix man page for socket option controlling delayed acks
Michael Tuexen [Wed, 21 Jun 2023 07:03:30 +0000 (09:03 +0200)]
sctp: fix man page for socket option controlling delayed acks

The SCTP_DELAYED_ACK_TIME socket option was replaced by the
SCTP_DELAYED_SACK in the socket API specification in
draft-ietf-tsvwg-sctpsocket-14.
The code was updated in r170056, but the man page was not.

PR: 272124

(cherry picked from commit 133b132bc1b612abe591c8f54680c3da8491e194)

12 months agoipmi: add Block Transfer interface support
Andrey V. Elsukov [Wed, 7 Jun 2023 09:30:47 +0000 (12:30 +0300)]
ipmi: add Block Transfer interface support

Reviewed by: ambrisko
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D40421

(cherry picked from commit 1f166509895dd90fcaaa08b557f9bc106e3f7e71)