Commit graph

1806 commits

Author SHA1 Message Date
Jose Luis Duran
f269d70719 pf tests: Remove Scapy as a required program
Scapy is not needed to run this test.  Remove it from the required
programs list.

Reviewed by:	kp
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D49006

(cherry picked from commit 1f1963bd32d669f89ea3b044636de0cb7a33134b)
2025-03-03 08:07:31 +01:00
Kristof Provost
b8ab1d06e8 pf tests: add more fragmentation test cases
Add more test cases for pf fragment hole counter.  Also look into
final fragment of echo reply and check total length of IP packet.

MFC after:	1 week
Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 640736615b
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit db100bd93036855c7688dc088b811dc7b660f51d)
2025-02-25 10:36:20 +01:00
Kristof Provost
7386d91261 pf: drop IPv6 packets built from overlapping fragments in pf reassembly
The reassembly state will be dropped after timeout, all related
fragments are dropped until that.  This is conforming to RFC 5722.
- Sort pf_fragment fields while there.
- If the fr_queue is empty, we had overlapping fragments, don't add
  new ones.
- If we detect overlapping IPv6 fragments, flush the fr_queue and
  drop all fragments immediately.
- Rearrange debug output, to make clear what happens.
- An IPv4 fragment that is totaly overlapped does not inclease the
  bad fragment counter.
- Put an KASSERT into pf_isfull_fragment() to make sure that the
  fr_queue is never emtpy there.
discussed with Fernando Gont; ok henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 8b45f36762
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 6a3266f72e437aecf3edcfb8aa919466b270d548)
2025-02-25 10:34:25 +01:00
Kristof Provost
5658e37b53 pf: allow ICMP messages related to an SCTP state to pass
Much like we already do for TCP and UDP we should also parse SCTP-in-ICMP
messages to see if they apply to an SCTP connection we've already allowed. If so
we should allow the ICMP packet to pass, even if we'd otherwise block it.

Add a test case where we generate an 'ICMP unreachable - need to frag' packet
and check that it passes through pf.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit 7d5e02b01577047290e937399accc02e6b184ce9)
2025-02-18 10:00:47 +01:00
Kristof Provost
f15f44029f pf: add 'allow-related' to always allow SCTP multihome extra connections
Allow users to choose to allow permitted SCTP connections to set up additional
multihomed connections regardless of the ruleset. That is, allow an already
established connection to set up flows that would otherwise be disallowed.

In case of if-bound connections we initially set the extra associations to
be floating, because we don't know what path they'll be taking when they're
created. Once we see the first traffic we can bind them.

MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D48453

(cherry picked from commit e4f2733df8c9d2fd0c5e8fdc8bec002bf39811f3)
2025-02-18 09:56:41 +01:00
Kristof Provost
063f4fdfc9 carp: don't unintentionally revert to multicast mode
PR:		284140
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-01-24 11:54:30 +01:00
Leonid Evdokimov
3de06e40f3 pf tests: check cleared time when zeroing stats for table addresses
Verify that we reset the cleared time when we zero an address' counters in
a table.

PR:		282877, 282984
Reviewed by:	kp
MFC after:	2 weeks
Signed-off-by:	Leonid Evdokimov <leon@darkk.net.ru>
Differential Revision:	https://reviews.freebsd.org/D48242

(cherry picked from commit 0749d8134300b8e3c956e161890ab496247d2542)
2025-01-16 19:18:17 +01:00
Leonid Evdokimov
d3d3ef2b33 pfctl: add -T reset to touch pfras_tzero only for non-zero entries
This will make it easier for scripts to detect idle hosts in tables.

PR:		282984
Reviewed by:	kp
MFC after:	2 weeks

(cherry picked from commit 5b59b0c61e29f684a019afdd2848ffe2d5604e0c)
2025-01-08 08:43:50 +01:00
Kristof Provost
744cdf0037 pfctl: clear statistic for specified addresses
The ioctl DIOCRCLRASTATS provides the functionality of clearing stats
not only for the whole table for for addresses stored in that table. The
functionality was missing from pfctl, though. Add it now.

PR:		282877
Obtained from:	OpenBSD, kirill <kirill@openbsd.org>, e496dff3a7
MFC after:	3 weeks

(cherry picked from commit 6463b6b59152fb1695bbe0de78f6e2675c5a765a)
2024-12-16 16:15:44 +01:00
Mark Johnston
598aaf9461 pf: Let rdr rules modify the src port if doing so would avoid a conflict
If NAT rules cause inbound connections to different external IPs to be
mapped to the same internal IP, and some application uses the same
source port for multiple such connections, rdr translation may result in
conflicts that cause some of the connections to be dropped.

Address this by letting rdr rules detect state conflicts and modulate
the source port to avoid them.

Reviewed by:	kp, allanjude
MFC after:	3 months
Sponsored by:	Klara, Inc.
Sponsored by:	Modirum
Differential Revision:	https://reviews.freebsd.org/D44488

(cherry picked from commit 9897a66923a3e79c22fcbd4bc80afae9eb9f277c)
2024-12-16 16:15:42 +01:00
Tom Jones
c000471757 pf: Correct SPDX identifier
Pointed out by: Mike Karels <karels@FreeBSD.org>

(cherry picked from commit 3db693f7da8a1aaf0a8887e7791ebb5d67c7a2d9)
2024-12-16 16:15:41 +01:00
Tom Jones
f97572931c pf: Add a TCP rdr test on IPv6
Reviewed by:    kp
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision: https://reviews.freebsd.org/D42105

(cherry picked from commit b9870ba93ea90a12f5a5727c80f7958b17f9afcc)
2024-12-16 16:15:41 +01:00
Kristof Provost
8a76301ae7 pf: fix potential NULL dereference in SCTP multihome handling
When processing an SCTP ASCONF we re-run the rules processing to check
if the new state should be allowed as well. We used to do so against the
'all' interface, to allow new connections to use any interface.

This is problematic for two reasons, the first being it may unexpectedly
bypass interface restrictions. The more important one is that it
can trigger panics. If the ruleset contains a rule which filters on
interface group we'd attempt to process the group list for the 'all'
interface. As this isn't a real interface it doesn't have an associated
struct ifnet, and we end up dereferencing a NULL pointer.

Solve this by not overriding the interface, instead leaving the physical
interface the SCTP ASCONF arrived on. This implies that we may end up
binding to that interface (if if-bound), and thus denying traffic on
other interfaces. Users can allow this anyway by setting 'state-policy
floating' on the relevant SCTP rules. This arguably better reflects user
intent as well. That is, we'll consider SCTP multihomed states to be
floating if we're in floating mode, and if-bound if we're if-bound.

Update the test cases to account for this, while adding a "pass on
lo" (i.e. pass on an interface group") rule to provoke this issue. Add
separate test cases for the floating and if-bound scenarios.

Reported by:	Franco Fichtner <franco@opnsense.org>
MFC after:	3 weeks
Sponsored by:	Orange Business Services
2024-12-16 16:15:41 +01:00
Alan Somers
d3459fe7f7 zfsd: replace vdevs with the AUX faulted state
Without this patch, vdevs faulted via AUX state would not be replaced
once the appropriate drive is replaced.  ZFS does not internally use
that state, but a drive can be manually forced into such a state with a
command like zinject.

Submitted by:	Goran Mekić <meka@tilda.center>
Sponsored by:	ConnectWise
Differential Revision: https://reviews.freebsd.org/D46866

(cherry picked from commit 618ae939b7f95a197a0518cbb390a572bb90c6d0)
2024-10-31 08:00:32 -06:00
Kristof Provost
df88800a03 pf tests: disable epsv for the ftp proxy test
The update to py-twisted 24.7.0 broke EPSV mode in twisted's ftp server.
Work around this by disabling EPSV (and thus using PASV).

PR:		282154
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 9cd6ab45a44607ea862c8bbb2ebaa8a7521178ff)
2024-10-21 14:51:36 +02:00
Kristof Provost
f3586d2693 netpfil tests: skip checksum verification in pft_ping.py
From scapy 2.6.0 it now removes (sets to None) the IP checksum in its defrag
code. We typically ask for IPv4 or IPv6 defragmentation, which causes check
function failures.

Just skip the checksum verificiation here, because we're going to notice
incorrect checksums even if the tests don't directly verify it.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 6b8096fa5f6f81e2959cbb2ca857c4e134273da2)
2024-10-21 14:51:36 +02:00
Mark Johnston
794fd74ab8 tests: Add some test cases for SO_SPLICE
Reviewed by:	gallatin
MFC after:	3 months
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D46412

(cherry picked from commit 877cf210c08b99aa532107e176b372de58579493)
2024-10-17 15:48:37 +00:00
Mark Johnston
9e6ff43535 netinet tests: Make some tests more reliable when run in parallel
Many of the modified tests add epair interfaces to the host, though most
of the tests themselves run in a VNET jail.  scapy in particular becomes
unhappy when the list of interfaces changes as it is running, so, to
improve reliability of parallel test runs, isolate tests which add
epairs to the host.

Also serialize arp tests, as they examine the dmesg as part of the test.

The list of modified tests is not exhaustive, it was determined by
running the test suite with parallelization enabled and looking at
failures.  It may be easier to just automatically enable VNET jailing of
all netinet tests, but let's be more particular for now.

Reviewed by:	kp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46606

(cherry picked from commit b103fc49ae160fdce221c2fffa98dde9bc0ff3b0)

Approved by:    kp (mentor), markj (mentor)
2024-10-17 13:45:45 +00:00
Kristof Provost
0e2a3e1da9 if_ovpn tests: allow these tests to run in parallel
Now that kyua can isolate tests in their own vnets we can run these tests in
parallel.

Reviewed by:	markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46600

(cherry picked from commit a05decec2d194821f8bf5c8f2ae72063de0c87a8)

Approved by:    kp (mentor), markj (mentor)
2024-10-17 13:45:35 +00:00
Kristof Provost
c5fc967cf1 netpfil tests: run in parallel
Run these tests in their own (vnet) jail so we don't have to worry about IP
range or jail name conflicts.

Reviewed by:	markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46040

(cherry picked from commit 4f752a1583dc97d166caae7f844bf42715e99978)

Approved by:    kp (mentor), markj (mentor)
2024-10-17 13:45:29 +00:00
Mark Johnston
81da8e39f7 geli tests: Work around a missing MFC
The test assumes commit 96950419f15510287080c557174e0d8409f06956, but
that was never MFCed to stable branches, resulting in a broken test.

This is a direct commit to stable/14.
2024-10-15 13:35:59 +00:00
Kristof Provost
ff5a685270 if_vlan: handle VID conflicts
If we fail to change the vlan id we have to undo the removal (and vlan id
change) in the error path. Otherwise we'll have removed the vlan object from the
hash table, and have the wrong vlan id as well. Subsequent modification attempts
will then try to remove an entry which doesn't exist, and panic.

Undo the vlan id modification if the insertion in the hash table fails, and
re-insert it under the original vlan id.

PR:		279195
Reviewed by:	zlei
MFC atfer:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D45285

(cherry picked from commit bdd12889eaa64032b3d09ef47e9a6f7081863378)
2024-10-11 12:04:09 +02:00
Alan Somers
cf2ed0edae fusefs: fix an uninitialized memory access in fuse_vnop_deallocate
If the FUSE_GETATTR issued to query a file's size during
fuse_vnop_deallocate failed for any reason, then fuse_vnop_deallocate
would attempt to destroy an uninitialized fuse_dispatcher struct, with a
crash the likely result.  This bug only affects FUSE file systems that
implement FUSE_FALLOCATE, and is unlikely to be seen on those that don't
disable attribute caching.

Reported by:	Coverity Scan
CID:		1505308

(cherry picked from commit f93a50d69df2e996ff1d4f793d0dcb9de655ebdc)
2024-10-10 12:48:39 -06:00
Mark Johnston
20191b71ba src.conf: Add a MK_ZFS_TESTS knob
The in-tree ZFS test suite is somewhat outdated and I see a number of
failures there.  I tend to think that we want to integrate the OpenZFS
test suite somehow, replacing the legacy one, though it's also possible
to run that as a separate test suite.

In any case, if one wants to run the OpenZFS test suite separately, it's
useful to be able to disable installation of the legacy ZFS test suite,
so let's provide a src.conf option to do that.

Reviewed by:	asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46476

(cherry picked from commit 24affded3d4ec5fafb6b22f773ec1e20d73b9b03)
2024-09-20 11:39:16 +00:00
Mark Johnston
6f636541a3 capsicum tests: Serialize functional tests
The test suite runs the same tests twice, as different users, and these
can trample over each other when run in parallel, causing spurious test
failures.

MFC after:	1 week

(cherry picked from commit 41ece3c036bda3d4da321989ee59d0555c10d603)
2024-09-20 11:39:16 +00:00
Mark Johnston
246f922d63 ggate tests: Use unique ports among tests
This helps avoid failures when running tests in parallel.

MFC after:	1 week

(cherry picked from commit b5d3f8252fe8b74249ed49e87981d190c3ec3d05)
2024-09-20 11:39:16 +00:00
Alan Somers
4bb8e26c26 fusefs: fix two bugs regarding _PC_MIN_HOLE_SIZE
Background:

If a user does pathconf(_, _PC_MIN_HOLE_SIZE) on a fusefs file system,
the kernel must actually issue a FUSE_LSEEK operation in order to
determine whether the server supports it.  We cache that result, so we
only have to send FUSE_LSEEK the first time that _PC_MIN_HOLE_SIZE is
requested on any given mountpoint.

Problem 1:

Unlike fpathconf, pathconf operates on files that may not be open.  But
FUSE_LSEEK requires the file to be open.  As described in PR 278135,
FUSE_LSEEK cannot be sent for unopened files, causing _PC_MIN_HOLE_size
to wrongly report EINVAL.  We never noticed that before because the
fusefs test suite only uses fpathconf, not pathconf.  Fix this bug by
opening the file if necessary.

Problem 2:

On a completely sparse file, with no data blocks at all, FUSE_LSEEK with
SEEK_DATA would fail to ENXIO.  That's correct behavior, but
fuse_vnop_pathconf wrongly interpreted that as "FUSE_LSEEK not
supported".  Fix the interpretation.

PR:		278135
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D44618

(cherry picked from commit 6efba04df3f8c77b9b12f1df3e5124a7249b82fc)
2024-09-19 14:27:41 -06:00
Alan Somers
e2217f8097 ctl: add tests for PREVENT ALLOW MEDIUM REMOVAL
Sponsored by:	Axcient
Reviewed by:    emaste, markj
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1409

(cherry picked from commit e234a72bb8c0e8e25ea8a879582e85bb2e09f096)
2024-09-19 14:24:02 -06:00
Alan Somers
37357ba28a ctl: add tests for START STOP UNIT
Sponsored by:	Axcient
Reviewed by:	emaste, markj
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1409

(cherry picked from commit fe1755fa6bb4039c1e00f5226c473a024685005b)
2024-09-19 14:23:59 -06:00
Alan Somers
e9329a869c ctl: add some ATF tests for READ BUFFER
Reviewed by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	Axcient

(cherry picked from commit 60d717baf2144cf344ec9b47d715ce837b5d46d4)
2024-09-04 15:00:20 +00:00
Kristof Provost
4909bd69dd pf tests: ensure that neighbour discovery works as expected
Also check repeated calls.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit d154dc21130b607d7903f276dd6d463b990f33f7)
2024-09-04 10:38:15 +02:00
Kristof Provost
485bd16308 pf: cope with SCTP port re-use
Some SCTP implementations will abort connections and then later re-use the same
port numbers (i.e. both src and dst) for a new connection, before pf has fully
purged the old connection.

Apply the same hack we already have for similarly misbehaving TCP
implementations and forcibly remove the old state so we can create a new one.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 82e021443a76b1f210cfb929a495185179606868)
2024-08-27 10:09:10 +02:00
Christos Margiolis
6ab8b418dc sound tests: Add SNDSTIOC_ADD_USER_DEVS test
Test whether the SNDSTIOC_ADD_USER_DEVS IOCTL (registers a userland
device to /dev/sndstat) works properly.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46228

(cherry picked from commit 2668e76d6e764c5c361156ffa3d39eb02ce8e5d9)
2024-08-26 16:52:02 +03:00
Kristof Provost
09d61b28a0 vnet tests: verify that we can load if_epair and if_bridge
We're going to start running many of the vnet tests in nested jails (so they
can run in parallel). That means the tests won't be able to load kernel modules,
which we commonly do for if_epair and if_bridge.

Just assume that all vnet tests need this, because so many of them do that we
don't want to manually annotate all of them.
This is essentially a no-op on non-nested tests.

Do the same for the python test framework.

While here also have pflog_init actually call pft_init. While having pflog
loaded implies we have pf too pft_init also checks for vimage support, and now
for if_epair.

Reviewed by:	markj
MFC after:	1 month
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46039

(cherry picked from commit ae8d58814089308028046ac80aeeb9cbb784bd0a)
2024-08-22 21:01:33 +02:00
Kristof Provost
145f5005ae pf tests: ensure temporary files end up in the atf working directory
Many of the tests create temporary files. pid files, log files, tcpdump
captures, ... We should take care to ensure they're stored in the temporary
working directory Kyua creates rather than in the root directory.

This ensures there are no conflicts between simultaneously running tests, and
also keeps the root directory clean.

MFC after:	1 month
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit b0fcf4d5222bfdbbc0e2af2b14f0d73704706aa0)
2024-08-22 21:01:33 +02:00
Kristof Provost
46c4fc50d3 pf: invert direction for inner icmp state lookups
(e.g. traceroute with icmp)
ok henning, jsing

Also extend the test case to cover this scenario.

PR:		280701
Obtained from:	OpenBSD
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 89f6723288b0d27d3f14f93e6e83f672fa2b8aca)
2024-08-20 17:15:10 +02:00
Kristof Provost
3455a02b5a pf tests: ensure that traceroutes using ICMP work
PR:		280701
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 34063cb714602972b6d985ad747fc8f66a8daae1)
2024-08-20 17:15:10 +02:00
Mark Johnston
58f9c14235 ktrace tests: Add a test case for handling of exec+setuid binaries
MFC after:	1 week

(cherry picked from commit 3852a5a226509551e72c13bce443707f80e863ce)
2024-08-15 14:29:49 +00:00
Mark Johnston
cb2657c962 netinet6 tests: Add a regression test for default router handling
This serves as a regression test for commit a48df53e4249.

Reviewed by:	bz, allanjude
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Bell Tower Integration
Differential Revision:	https://reviews.freebsd.org/D46136

(cherry picked from commit feda329622bc77ab64ae5f0bf852743f4a037616)
2024-08-08 19:11:34 +00:00
Ed Maste
f06d322e9d Remove "All Rights Reserved" from FreeBSD Foundation copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5c2bc3db201a4fe8d7911cf816bea104d5dc2138)
2024-08-06 15:39:53 -04:00
Mark Johnston
014b6c341d ktrace tests: Add a missing mode in open(O_CREAT)
MFC after:	1 week

(cherry picked from commit 9cc67e43610e34a692398a65adcc5e8846e84250)
2024-08-06 16:40:51 +00:00
Kristof Provost
3e1f815655 pf tests: ensure we don't confuse different ICMP types
When creating a state for ICMP (v4 or v6) packets we only used the ID, which
means that we could confuse different ICMP types. For example, if we allowed
neighbour discovery but not ICMPv6 echo requests an ND packet could create a
state that the echo request would match.

Test that this is now fixed.

Reported by:	Enrico Bassetti <e.bassetti@tudelft.nl>
MFC after:	1 day
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit b9f0dbc3d006e0b904ee4275d54459f4edd65bb8)
2024-07-31 09:39:53 +02:00
Mark Johnston
bed96ef09d socket tests: Serialize sonewconn_overflow
It relies on being able inspect the dmesg buffer to see whether the
kernel logged certain messages.  If it's interleaved with tests that
generate large amounts of console output (e.g., GELI tests), then it can
fail spuriously.

MFC after:	2 weeks

(cherry picked from commit ab27e232b14c07317642a2e4c546c9b71bd9c00b)
2024-07-30 15:55:32 +00:00
Mark Johnston
fb8670d3f8 gnop tests: Serialize
Some of these tests make use of test disk devices, but then they can't
run in parallel.

MFC after:	2 weeks

(cherry picked from commit dc8357de606aa65fc1c35a43d4a5f1d706164ddb)
2024-07-30 15:55:32 +00:00
Christos Margiolis
22be802cf8 sound tests: Add sndstat nvlist ATF test
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45901

(cherry picked from commit 95eb4b873b6a8b527c5bd78d7191975dfca38998)
2024-07-29 18:34:54 +03:00
Kristof Provost
4f5440f2ab pf tests: fix sctp:timeout test
The test body somehow wound up in the cleanup function.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit fe0c82a603ce069786ee81604315f499fd965546)
2024-07-25 10:23:31 +02:00
Kristof Provost
5acd8ff566 pf tests: test setting and retrieving timeout values
(cherry picked from commit 8ed5170c66ec4914e90c2f3657227ceb9e35193f)
2024-07-25 10:23:29 +02:00
Mark Johnston
b14a491283 ktls: Fix races that can lead to double initialization
ktls_enable_rx() and ktls_enable_tx() have checks to return EALREADY if
the socket already has KTLS enabled.  However, these are done without
any locks held and nothing blocks concurrent attempts to set the socket
option.  I believe the worst outcome of the race is leaked memory.

Fix the problem by rechecking under the sockbuf lock.  While here, unify
the locking protocol for sb_tls_info: require both the sockbuf and
socket I/O locks in order to enable KTLS.  This means that either lock
is sufficient for checking whether KTLS is enabled in a given sockbuf,
which simplifies some refactoring further down the road.

Note that the SOLISTENING() check can go away because
SOCK_IO_RECV_LOCK() atomically locks the socket buffer and checks
whether the socket is a listening socket.  This changes the returned
errno value, so update a test which checks it.

Reviewed by:	gallatin
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45674

(cherry picked from commit 163cdf6a32b9a0f84226a70101d143c10707336f)
2024-07-23 09:01:30 -04:00
Mark Johnston
c1dd895406 sched tests: Avoid underflow when maxcpuid == 0
MFC after:	1 week

(cherry picked from commit 5b98bd30686a358b2a20728a4a6b5cecb7e28dc9)
2024-07-21 20:55:27 -04:00
Gleb Smirnoff
5a676edf9b netpfil tests: disable ICMPv6 rate limiting in the test jail
The dummynet test uses flood ping as source of traffic, so the rate
limiting of ICMP replies broke the test.

Fixes:	32aeee8ce7e72738fff236ccd5629d55035458f8
(cherry picked from commit 75d15e893b14188b83c5fb5e4979fa21c557934f)
2024-06-26 12:48:44 +08:00