Commit graph

276359 commits

Author SHA1 Message Date
Kristof Provost 2fc1fc66c7 if_ovpn tests: Test if_ovpn when there's no route
In client mode (i.e. if there's only one peer) we should be able to
route to the correct peer even if the routing table is incorrect.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 13:51:30 +02:00
Kristof Provost f8b1ddbfb1 if_ovpn tests: tunnel with CHACHA20-POLY1305
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2022-06-28 13:51:24 +02:00
Kristof Provost c09e62cd91 if_ovpn tests: test pf's route-to
Ensure that pf's route-to works with if_ovpn.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 13:51:24 +02:00
Kristof Provost 85a15e4704 if_ovpn tests: IPv6 in IPv4 and IPv4 in IPv6 tunnels
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 13:51:15 +02:00
Kristof Provost 3d4f61350d if_ovpn tests: tunnel over IPv6
Set up a tunnel over IPv6 carrying IPv6 traffic.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
2022-06-28 13:50:58 +02:00
Kristof Provost b33308db39 if_ovpn: static probe points
Sprinkle a few SDTs around if_ovpn to ease debugging.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 13:50:54 +02:00
Kristof Provost 08926ae328 if_ovpn tests: timeout on clients
Test that openvpn (DCO) clients are notified and handle timeout events.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35091
2022-06-28 13:50:45 +02:00
Kristof Provost 067acae2f3 if_ovpn tests: basic test case
Set up an OpenVPN tunnel between two jails, send traffic through them to
confirm basic function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35067
2022-06-28 13:50:37 +02:00
Kristof Provost ab91feabcc ovpn: Introduce OpenVPN DCO support
OpenVPN Data Channel Offload (DCO) moves OpenVPN data plane processing
(i.e. tunneling and cryptography) into the kernel, rather than using tap
devices.
This avoids significant copying and context switching overhead between
kernel and user space and improves OpenVPN throughput.

In my test setup throughput improved from around 660Mbit/s to around
2Gbit/s.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34340
2022-06-28 11:33:10 +02:00
Peter Holm a25818eb28 stress2: Added comment about problem found 2022-06-28 11:30:51 +02:00
Peter Holm 8e64658873 stress2: Update the exclude list 2022-06-28 11:30:11 +02:00
Kristof Provost 07ffa50ba0 pf tests: test short packets
Test sending very short packets (i.e. too short for an IP header)
packets in the Ethernet filtering code.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 10:31:23 +02:00
Kristof Provost fd72bfa626 pf: ensure mbufs are long enough before we copy out IP(v6) headers
This isn't likely to be an issue on real hardware (as Ethernet has a
minimal packet length of 64 bytes), but can cause panics with short
packets on if_epair.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 10:31:23 +02:00
Kristof Provost 6f16d78c0d pf: add missing maximum length check for DIOCADDETHRULE
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-28 10:31:23 +02:00
Roger Pau Monné 881c145431 elfnote: place note in a PT_NOTE program header
Some tools (firecraker loader) only check for notes in PT_NOTE program
headers, so make sure the notes added using the ELFNOTE macro end up
in such header.

Output from readelf -Wl for and amd64 kernel after the change:

Elf file type is EXEC (Executable file)
Entry point 0xffffffff8038a000
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0xffffffff80200040 0x0000000000200040 0x000268 0x000268 R   0x8
  INTERP         0x0002a8 0xffffffff802002a8 0x00000000002002a8 0x00000d 0x00000d R   0x1
      [Requesting program interpreter: /red/herring]
  LOAD           0x000000 0xffffffff80200000 0x0000000000200000 0x189e28 0x189e28 R   0x200000
  LOAD           0x18a000 0xffffffff8038a000 0x000000000038a000 0xe447e8 0xe447e8 R E 0x200000
  LOAD           0xfce7f0 0xffffffff811ce7f0 0x00000000011ce7f0 0x6b955c 0x6b955c R   0x200000
  LOAD           0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x200000
  LOAD           0x1801000 0xffffffff81a01000 0x0000000001a01000 0x1c8480 0x5ff000 RW  0x200000
  DYNAMIC        0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x8
  GNU_RELRO      0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 R   0x1
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
  NOTE           0x1687ae0 0xffffffff81887ae0 0x0000000001887ae0 0x0001c0 0x0001c0 R   0x4

 Section to Segment mapping:
  Segment Sections...
[...]
   10     .note.gnu.build-id .note.Xen

Reported by: cperciva
Fixes: 1a9cdd373a ('xen: add PV/PVH kernel entry point')
Fixes: 93ee134a24 ('Integrate support for xen in to i386 common code.')
Sponsored by: Citrix Systems R&D
Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D35611
2022-06-28 09:51:57 +02:00
Roger Pau Monné 091febc04a xen/blkback: do not use x86 CPUID in generic code
Move checker for whether Xen creates IOMMU mappings for foreign pages
into a helper that's defined in arch-specific code.

Reported by: Elliott Mitchell <ehem+freebsd@m5p.com>
Fixes: 1d528f95e8 ('xen/blkback: remove bounce buffering mode')
Sponsored by: Citrix Systems R&D
2022-06-28 09:51:57 +02:00
Kirk McKusick 2049cc3218 Correctly update fs_dsize in growfs(8)
When growing a UFS/FFS filesystem, the size of the summary information
may expand into additional blocks. These blocks must be removed from
fs_dsize which records the number of blocks in the filesystem that can
be used to hold filesystem data.

While here also update the fs_old_dsize and fs_old_size fields for
compatibility with kernels that were compiled before the addition
of UFS2.

Reported by: Edward Tomasz Napiera
MFC after:   1 week
2022-06-27 21:48:24 -07:00
Kirk McKusick 78dfcf256a Eliminate set but not used variable.
No functional change intended.
2022-06-27 21:48:24 -07:00
Kyle Evans 9fcac31db4 date: attempt to more accurately describe year limitations with -v
The previous description was both incorrect and incomplete in its
description -- the 2038 limit doesn't apply on !i386 platforms, and
it didn't note that values above 100 are accepted and interpreted
differently.  Further, it didn't note that absolute years are accepted.

Reviewed by:	pauamma_gundo.com (manpages)
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35360
2022-06-27 22:54:13 -05:00
Gleb Smirnoff ad3ad06477 blackhole(4): fix operator precedence
Fixes:	3ea9a7cf7b
2022-06-27 17:52:19 -07:00
Warner Losh d8f3ef8f54 kboot: rename kexec_load to host_kexec_load
And make it match the system call more closely by passing in the proper
args.

Sponsored by:		Netflix
2022-06-27 14:54:45 -06:00
Warner Losh 201c1d0d25 kboot: sort system calls
Sort the system calls. No functional change intended.

Sponsored by:		Netflix
2022-06-27 14:54:45 -06:00
Warner Losh 43ad112b93 kboot: use SYS_kexec_load insteaed of __NR_kexec_load
Make this regular with the rest of the system calls.

Sponsored by:		Netflix
2022-06-27 14:54:45 -06:00
Warner Losh ce3e4a3a96 kboot: Sort system calls alphabetically
No functional change: sort the system calls alphbetically to make it
easier to add new ones.

Sponsored by:		Netflix
2022-06-27 14:54:45 -06:00
Greg V e6ba4cda73 devmatch: Properly ignore commented fields
Any field that starts with # is a commented out field (there as a place
holder only, the data in that place holder is completely ignored). The
previous code improperly detected this using strcmp. Instead, any field
whose names starts with '#' is ignored.

Differential Reivsion: https://reviews.freebsd.org/D34633
2022-06-27 14:44:23 -06:00
Gleb Smirnoff f25727898a ObsoleteFiles: flowtable header deleted in 2017
Miss from ae69ad884d
2022-06-27 12:31:36 -07:00
Alexander V. Chernikov 9c42645a1e testing: workaround pytest parser bug in pytest-atf-wrapper.
Reviewed by:	lwhsu, kp
Differential Revision: https://reviews.freebsd.org/D35614
MFC after:	2 weeks
2022-06-27 17:30:53 +00:00
Alexander V. Chernikov 8010b7a78a routing: simplify decompose_change_notification().
The function's goal is to compare old/new nhop/nexthop group for the route
 and decompose it into the series of RTM_ADD/RTM_DELETE single-nhop
 events, calling specified callback for each event.
Simplify it by properly leveraging the fact that both old/new groups
 are sorted nhop-# ascending.

Tested by:	Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35598
MFC after: 2 weeks
2022-06-27 17:30:52 +00:00
Alexander V. Chernikov 76f1ab8eff routing: actually sort nexthops in nhgs by their index
Nexthops in the nexthop groups needs to be deterministically sorted
 by some their property to simplify reporting cost when changing
 large nexthop groups.

Fix reporting by actually sorting next hops by their indices (`wn_cmp_idx()`).
As calc_min_mpath_slots_fast() has an assumption that next hops are sorted
using their relative weight in the nexthop groups, it needs to be
addressed as well. The latter sorting is required to quickly determine the
layout of the next hops in the actual forwarding group. For example,
what's the best way to split the traffic between nhops with weights
19,31 and 47 if the maximum nexthop group width is 64?
It is worth mentioning that such sorting is only required during nexthop
group creation and is not used elsewhere. Lastly, normally all nexthop
are of the same weight. With that in mind, (a) use spare 32 bytes inside
`struct weightened_nexthop` to avoid another memory allocation and
(b) use insertion sort to sort the nexthop weights.

Reported by:	thj
Tested by:	Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35599
MFC after:	2 weeks
2022-06-27 17:30:52 +00:00
Yuri f4497b9f77 smartpqi: Allocate DMA memory NOWAIT
We're not allowed to wait in this allocation path, so allocate the
memory NOWAIT instead of WAITOK. The code already copes with the
failures that may result, so no additional code is needed.

PR: 263008
Reviewed by: markj, Scott Benesh at Microsemi, imp
Differential Revision: https://reviews.freebsd.org/D35601
2022-06-27 11:06:31 -06:00
Michael Tuexen 121ecca0d8 sctp: add KASSERTs to ensure correct handling of listeners
This was suggested by markj@.

MFC after:	3 days
2022-06-27 19:04:45 +02:00
Gleb Smirnoff bafe71fd27 sctp: do not clobber listening socket with sockbuf operations
The problem was here since 779f106aa1, but a4fc41423f turned it
into a panic.

Reviewed by:	tuexen
Reported by:	syzcaller
2022-06-27 09:24:49 -07:00
Fernando Apesteguía 4a3c598f35 Bump .Dd for recently modified manual pages
During the removal of named(8) references, some pages were modified but their
.Dd where not updated accordingly.

Reported by:	lwhsu@
Fixes:	942e234d86
2022-06-27 18:20:03 +02:00
Ed Maste 7927452ac4 Fix cross-builds from macOS
The macOS linker does not support -zrelro/-znorelro.  Since it is only
used to for build tools that run on the host, and WITH_RELRO or
WITHOUT_RELRO does not matter there, just skip the option.

Reviewed by:	markj
Fixes:		2f3a961487 ("Add RELRO build knob, default to enabled")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35589
2022-06-27 10:22:12 -04:00
Kristof Provost 1e824ee84f if_bridge tests: test adding interfaces with different MTU
We now allow new bridge members to be added with a different MTU from
the bridge. We change the interface MTU to match the bridge.
Test this.

PR:	264883
2022-06-27 08:27:28 +02:00
Kristof Provost 1865ebfb12 if_bridge: change MTU for new members
Rather than reject new bridge members because they have the wrong MTU
change it to match the bridge. If that fails, reject the new interface.

PR:	264883
Different Revision:	https://reviews.freebsd.org/D35597
2022-06-27 08:27:27 +02:00
Hans Petter Selasky 9971e6aff1 vt: Improve multi lingual word separation.
Suggested by:	Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-06-27 10:17:16 +02:00
Hans Petter Selasky 5fe0a82501 vt: Fix contents of paste buffer for newcons.
Trim all word separators from end of line, except for last line and
only use '\r' to terminate the pasted lines as expected by TTY.

Submitted by:	Ivan Quitschal <tezeka@hotmail.com>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-06-27 10:17:16 +02:00
Mateusz Guzik 7388fb714a cache: drop the vfs.cache_rename_add tunable
The functionality has been in use since Jan 2021 -- long enough(tm).
2022-06-27 09:56:20 +02:00
Bjoern A. Zeeb d78bef0ebe hwpmc: further fix build (__diagused/debug/missing files entries)
Fix builds after 1459a22787 and
59191f3573 by using __diagused
for variables only used in KASSERT().
In addition remove two debug lines that look like a copy and paste error
from dmc620 to cmn600.
Further add the newly introduced files to sys/confg/files.arm64 as well
so that LINT compiles without missing symbols.
2022-06-27 01:36:52 +00:00
Bjoern A. Zeeb af8317c31a pmc: unhide struct pmc_md_dmc620_pmu_op_pmcallocate
Fix build after e3572eb654 as
struct pmc_md_dmc620_pmu_op_pmcallocate is needed when building
libpmc/pmclog.c as it is partof the public API via machine/pmc_mdep.h.
2022-06-27 00:37:23 +00:00
Bjoern A. Zeeb dd2fd62184 libpmc: attempt to fix the build
Try to fix the build (blindly) after e3572eb654.
I had missed the missing #ifdef in the review.  Hope that's all it takes.
2022-06-26 23:14:56 +00:00
Aleksandr Rybalko 59191f3573 Add support of ARM CMN-600 controller, PMU access functions only. Add support of PMU counters of ARM CMN-600 controller.
Add support of ARM CMN-600 controller, PMU access functions only.
Add support of PMU counters of ARM CMN-600 controller.

Reviewed by: mhorne
Sponsored By: ARM
Differential Revision: https://reviews.freebsd.org/D32321
2022-06-26 22:03:04 +03:00
Aleksandr Rybalko 1459a22787 The Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Add the Arm CoreLink DMC-620 Dynamic Memory Controller PMU driver
Add DMC-620 support to hwpmc(4)

Reviewed by: mhorne
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D32670
2022-06-26 21:57:56 +03:00
Aleksandr Rybalko e3572eb654 Allocate event for DMC-620 and CMN-600 controllers PMU. Add events supported by DMC-620 and CMN-600 controllers PMU.
Allocate event for DMC-620 and CMN-600 controllers PMU.
Add events supported by DMC-620 and CMN-600 controllers PMU.

Reviewed by: bz
Sponsored By: ARM
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D35609
2022-06-26 21:52:26 +03:00
Alan Cox 7b39a9bc1d iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT
As of 19bb5a7244, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by:	dougm
MFC with:	19bb5a7244
2022-06-26 16:31:54 -05:00
Bjoern A. Zeeb 841719c08f LinuxKPI: 802.11: remove an early bandaid to make sure queues are allocated
iwlwifi allocates queues on first wakeup.  This takes a lot longer on
FreeBSD's work implementation that it seems to on Linux based on some
discussion.  That meant that we couldn't get non-data frames out quickly
enough initially and failed to associate.
d0d2911035 should have solved most of this
for us with iwlwifi.  None of the other drivers ported to LinuxKPI/802.11
up to today will call a dequeue so we get notified when the queus are
allocated or even need to do so.
Remove the bandaid initilly put in for iwlwifi now and speed up the
overall process of getting us associated.

MFC after:	3 days
2022-06-26 19:17:04 +00:00
Bjoern A. Zeeb e24e8103e0 LinuxKPI: 802.11: cleanup lsta better
This changes cleans up lsta from the VIF station list as well as
deals with freeing the lsta itself so it is not leaked.

lkpi_iv_update_bss() makes this more complicated than it should be
as we ties more sta state (incl. drv/fw) to the node that net80211
does not know about.  There is more work to be done detangling this
now that is better understood.

MFC after:	3 days
2022-06-26 19:13:00 +00:00
Bjoern A. Zeeb ed3ef56b29 LinuxKPI: 802.11: sync sta->addr in lkpi_iv_update_bss()
In lkpi_iv_update_bss() introduced in d9f59799fc we swap lsta and
along with that sta and drv state if ni gets reused and swapped under
us by net80211.  What we did not do was to sync sta->addr which later
(usually in lkpi_sta_assoc_to_run) during a bss_info update cause
problems in drivers (or firmware) as the BSSID and the station address
were not aligned.

If this proves to hold up to fix iwlwifi issues seem on firmware
for older chipsets, multi-assoc runs, and rtw89 (which this fixes)
we should add asserts that lkpi_iv_update_bss() can only happen in
pre-auth stages and/or make sure we factor out synching more state
fields.

Found debugging:	rtw89
MFC after:		3 days
2022-06-26 19:04:16 +00:00
Bjoern A. Zeeb 9597f7cb99 Revert "LinuxKPI: 802.11: fix iwlwifi fw assert with older chipsets"
This reverts commit 013e516dc9.
2022-06-26 18:50:36 +00:00