Commit Graph

1621 Commits

Author SHA1 Message Date
Andrew Turner
2ff6e4ee97 Remove PAGE_SIZE from the kcov tests
To allow for a dynamic page size on arm64 remove the static valud from
the kcov tests

Sponsored by:	The FreeBSD Foundation
2022-06-17 10:43:30 +01:00
John Baldwin
ea4ebdcb4d ktls_test: Permit an option to skip tests not using ifnet TLS.
If ktls.require_ifnet is set to true, then check the TLS offload mode
for tests sending and receiving records and skip the test if the
offload mode is not ifnet mode.

This can be used along with ktls.host to run KTLS tests against a NIC
supporting ifnet TLS and verify that expected cipher suites and
directions used ifnet TLS rather than software TLS.  Receive tests may
result in a false positive as receive ifnet TLS can use software as a
fallback.

Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D35427
2022-06-14 10:35:01 -07:00
John Baldwin
2400a7b18f ktls_test: Permit connecting to a remote echo server for tests.
Previously ktls tests always executed over a local socket pair.
ktls.host can be set to a host to connect to with a single socket
instead.  The remote end is expected to echo back any data received
(such as the echo service).  The port can be set with ktls.port which
defaults to "echo".

This is primarily useful to permit testing NIC TLS offload use cases
where the traffic needs to transit the NIC.

Note that the variables must be set via
'kyua -v test_suites.FreeBSD.ktls.host=host'.

Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D35426
2022-06-14 10:34:51 -07:00
John Baldwin
2c10520533 ktls_test: Add a helper function to close sockets.
Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D35425
2022-06-14 10:34:38 -07:00
Gleb Smirnoff
d97922c6c6 unix/*: rewrite unp_internalize() cmsg parsing cycle
Make it a complex, but a single for(;;) statement.  The previous cycle
with some loop logic in the beginning and some loop logic at the end
was confusing.  Both me and markj@ were misleaded to a conclusion that
some checks are unnecessary, while they actually were necessary.

While here, handle an edge case found by Mark, when on 64-bit platform
an incorrect message from userland would underflow length counter, but
return without any error.  Provide a test case for such message.

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35375
2022-06-06 10:05:28 -07:00
Thomas Pasqualini
536e1da18b pf tests: pfsync and route_to test case
Test pfsync in a more realistic scenario with carp and route_to rules.

Build this topology and initiate a single ping session from client to
server:
		   ┌──────┐
		   │client│
		   └───┬──┘
		       │
		   ┌───┴───┐
		   │bridge0│
		   └┬─────┬┘
		    │     │
   ┌────────────────┴─┐ ┌─┴────────────────┐
   │gw_route_to_master├─┤gw_route_to_backup│
   └────────────────┬─┘ └─┬────────────────┘
		    │     │
		   ┌┴─────┴┐
		   │bridge1│
		   └┬─────┬┘
		    │     │
   ┌────────────────┴─┐ ┌─┴────────────────┐
   │gw_reply_to_master├─┤gw_reply_to_backup│
   └────────────────┬─┘ └─┬────────────────┘
		    │     │
		   ┌┴─────┴┐
		   │bridge2│
		   └───┬───┘
		       │
		   ┌───┴──┐
		   │server│
		   └──────┘

gw* jails forward traffic through pf route-to rules, not fib lookups.
If backup_promotion arg is given (as in the pfsync_pbr test case), a
carp failover event occurs during the ping session on both gateways.

Verify that ping messages still go where we expect them to go.

MFC after:	2 weeks
Sponsored by:	Orange Business Services
2022-06-04 14:23:17 +02:00
Gleb Smirnoff
70d07b2089 tests/unix_dgram: add test for event dispatchers
Put some data into a socket and check that:

o select(2) sees readable data
o kevent(2) sees data, and correctly sees data size
o ioctl(FIONREAD) sees correct size
o aio(4) successfully reads the data

Repeat the test twice for a connected socket and not-connected.  With
future implementation these two cases would exercise different code.
2022-06-03 12:55:44 -07:00
KUROSAWA Takahiro
d6cd20cc5c netinet6: fix ndp proxying
We could insert proxy NDP entries by the ndp command, but the host
with proxy ndp entries had not responded to Neighbor Solicitations.
Change the following points for proxy NDP to work as expected:
* join solicited-node multicast addresses for proxy NDP entries
  in order to receive Neighbor Solicitations.
* look up proxy NDP entries not on the routing table but on the
  link-level address table when receiving Neighbor Solicitations.

Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D35307
MFC after:	2 weeks
2022-05-30 10:53:33 +00:00
Cy Schubert
05882e28fb tests: Fix i386 and powerpc build
Fix:

tests/sys/kern/unix_passfd_test.c:414:24: error: comparison of integers
of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
        ATF_REQUIRE(getnfds() == nfds + MAXFDS);
        ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
powerpc.powerpc/tmp/usr/include/atf-c/macros.h:144:15: note: expanded
from macro 'ATF_REQUIRE'
        if (!(expression)) \
              ^~~~~~~~~~
1 error generated.
--- unix_passfd_test.o ---
2022-05-27 14:04:17 -07:00
Gleb Smirnoff
23402c83f4 tests/unix_passfd: sending many and too many SCM_RIGHTS
o Exercise bounds checking when sending large set of file descriptors,
  that can't fit into single control mbuf.
o Exercise resource limits checks when receiving a large sets.
o Check that socket isn't left in a completely stuck state when we can't
  receive SCM_RIGHTS due to limits.  Current SOCK_STREAM socket would
  free the control, but leave the data in.  This seems to be a legit
  behavior for a stream socket, as we don't want holes in the data.

PR:			239250
Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35315
2022-05-25 13:28:40 -07:00
Mark Johnston
68fe988a40 kqueue tests: Simplify the test runner
Just invoke the test program directly instead of trying to convert its
output to TAP format.  The test suite is all or nothing; there's no way
to enumerate individual test cases, so there's no advantage in trying to
massage its output, and doing so throws away information that's useful
when diagnosing test failures.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-24 20:17:41 -04:00
Mark Johnston
d6d4f9b45e kqueue tests: Add new EVFILT_TIMER regression tests from upstream
One of the tests exposes the regression reported in PR 264131.

One test is disabled because FreeBSD does not support setting EV_ONESHOT
on an already-added periodic timer.  Though, in this case the flag is
simply ignored, which isn't ideal.

One test is slightly modified to set EV_ADD when reconfiguring a
disabled timer per some commentary in PR 258412.

Ideally we would re-import the test suite from libkqueue but there is a
fair bit of divergence so this will require some effort.  This just gets
us one small step closer while increasing test coverage.

PR:		258412
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-24 20:16:32 -04:00
Mark Johnston
c728c56c87 kqueue tests: Add file and line info to some test failure output
This brings us slightly closer to upstream and is useful when debugging
test failures.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-24 20:14:20 -04:00
Mark Johnston
bc7512cc58 kqueue tests: Re-enable kqueue proc tests
- Some EVFILT_PROC bugs were fixed around the time that the tests were
  disabled.
- I can't reproduce any failures locally.
- Jenkins logs referenced from the PR are gone, so let's re-enable the
  tests and see whether a problem persists.

PR:		233586
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-24 20:14:10 -04:00
Olivier Cochard
2d896da92a tests/unix_passfd: Prevent running them in parallel
Only the send_and_shutdown test is exclusive, but kyua doesn't allow
to prevent parallel execution of a single test.

Approved by:	glebius
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35260
2022-05-23 15:44:10 +02:00
Mark Johnston
670be460e4 bitstring_test: Add regression tests for bit_ff(c|s)_area_at()
Validate the cases where a match can be found immediately and where no
match can be found.  This extends the existing test cases and is enough
to catch the bug fixed in commit 6e7a585348 ("bitstring: fix ff_area()
when start!=0").

Reviewed by:	dougm
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35259
2022-05-20 10:36:05 -04:00
Kristof Provost
b3fa36efe7 pf tests: extend ethernet dummynet test
Extend the existing ethernet dummynet test to also test dummynet on the
outbound direction.
This used to be a problem as traffic shaping wasn't done in the ethernet
code. It merely tagged the packet and left shaping up to the layer 3 pf
code. This works in the inbound direction, but not for outbound traffic
where we hit the L3 code first and only then the L2 code.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35258
2022-05-20 14:49:31 +02:00
Olivier Cochard
c678572e76 Prevent running sigwait tests in parallel
test_sig_discard_ign_* could not run at the same time.

Approved by:	dchagin
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35236
2022-05-17 23:33:39 +02:00
Gleb Smirnoff
aa9f97af93 tests/unix_dgram: account for size of sender address in the filling cycle
This fixes test failure with large net.local.dgram.recvspace values.
2022-05-16 19:08:21 -07:00
Dmitry Chagin
d966efcc08 fusefs tests: Remove an unused variable.
Reviewed by:		asomers
Differential revision:	https://reviews.freebsd.org/D35185
MFC after:		2 weeks
2022-05-13 20:52:14 +03:00
Alan Somers
0bef4927ea fusefs: handle evil servers that return illegal inode numbers
* If during FUSE_CREATE, FUSE_MKDIR, etc the server returns the same
  inode number for the new file as for its parent directory, reject it.
  Previously this would triggers a recurse-on-non-recursive lock panic.

* If during FUSE_LINK the server returns a different inode number for
  the new name as for the old one, reject it.  Obviously, that can't be
  a hard link.

* If during FUSE_LOOKUP the server returns the same inode number for the
  new file as for its parent directory, reject it.  Nothing good can
  come of this.

PR:		263662
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D35128
2022-05-12 14:32:26 -06:00
Alan Somers
8b582b1640 fusefs: make the mknod.cc tests a bit more general.
MFC after:      2 weeks
Reviewed by:    pfg
2022-05-12 14:31:57 -06:00
Kristof Provost
920c341087 pf tests: test dummynet on route-to'd packets
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35161
2022-05-12 21:50:10 +02:00
Kristof Provost
1977d9a37b pf tests: factor out common dummynet check
Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35160
2022-05-12 21:50:10 +02:00
Dmitry Chagin
e4a257058c tests: Get rid of invalid since 3e11d3f6 testcase
MFC after:		2 weeks
2022-05-12 22:14:41 +03:00
Gleb Smirnoff
6d31772360 tests/kern: add tests for PF_UNIX/SOCK_DGRAM 2022-05-12 11:02:41 -07:00
Dmitry Chagin
c8b5c478f6 Add tests for affinity syscalls.
MFC after:		2 weeks
2022-05-11 10:39:18 +03:00
Alan Somers
10f44229dc Fix overflow errors in sbttous and sbttoms
Both of these functions would overflow for very large inputs.  Add tests
for them.  Also, add tests for the inverse functions, *stosbt, whose
overflow errors were fixed by 4c30b9ecd4.

PR:		263073
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D34809
2022-05-09 16:38:59 -06:00
Gleb Smirnoff
2400c536b4 tests/unix_passfd: add test for shutdown(2) on a buffer with an fd
This has two goals:
- Exercize call to unp_dispose() via soshutdown() instead of sofree()
- Make sure that shutdown indeed dereferences the fd stored

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35122
2022-05-09 10:42:48 -07:00
Kristof Provost
868bf82153 if: avoid interface destroy race
When we destroy an interface while the jail containing it is being
destroyed we risk seeing a race between if_vmove() and the destruction
code, which results in us trying to move a destroyed interface.

Protect against this by using the ifnet_detach_sxlock to also covert
if_vmove() (and not just detach).

PR:		262829
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D34704
2022-05-06 13:55:08 +02:00
Ed Maste
adbe6e6435 Reenable vnet tests in CI
After restoring the associated commits the tests can be enabled again.

This reverts commit 711524d961.
This reverts commit c4585b938a.

PR:		263767
2022-05-05 14:38:08 -04:00
Alan Somers
4ac4b12699 fusefs: annotate more file descriptor leaks in the tests
The fusefs tests intentionally leak file descriptors.  Annotate all of
the leakages in order to hopefully pacify Coverity.

Reported by:	Coverity (20 different CIDs)
MFC after:	2 weeks
Sponsored by:	Axcient
2022-05-05 09:06:04 -06:00
Marko Zec
c4585b938a tests: vnet tests started failing in CI, disable temporarily
As a fallout of backing out 91f44749c6, vnet tests started
failing in CI.  Temporarily broadly disable vnet tests until
specific cases can be resolved, and file a bug.

PR:		263767
Differential Revision:	https://reviews.freebsd.org/D35119
Submitted by:	kbowling
2022-05-04 06:19:46 +02:00
Marko Zec
711524d961 tests/dummynet: disable since mbuf pointer serialization KPI to be backed out
Obtained from:	github.com/glebius/FreeBSD/commits/backout-ifindex
2022-05-03 19:11:39 +02:00
Alan Somers
2f6362484c fusefs: use the fsname mount option if set
The daemon can specify fsname=XXX in its mount options.  If so, the file
system should report f_mntfromname as XXX during statfs.  This will show
up in the output of commands like mount and df.

Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35090
2022-04-29 11:10:03 -06:00
Alan Somers
616eaa66aa fusefs: add a test for the subtype= option
At mount time server can set, for example, "subtype=xfs", so that
mount(8) will later show the mountpoint's file system as "fusefs.xfs".
fusefs has had this feature ever since the original GSoC commit in 2012,
but there's never been a test for it.

MFC after:	2 weeks
2022-04-29 07:59:29 -06:00
Alan Somers
45825a12f9 fusefs: fix FUSE_CREATE with file handles and fuse protocol < 7.9
Prior to fuse protocol version 7.9, the fuse_entry_out structure had a
smaller size.  But fuse_vnop_create did not take that into account when
working with servers that use older protocols.  The bug does not matter
for servers which don't use file handles or open flags (the only fields
affected).

PR:		263625
Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
MFC after:	2 weeks
2022-04-28 15:13:09 -06:00
Dmitry Chagin
0ced2aef06 Fix build after 128b9bf9
MFC after:	2 weeks
2022-04-25 14:45:05 +03:00
Dmitry Chagin
128b9bf96c Add tests for sigwait family syscalls.
MFC after:		2 weeks
2022-04-25 13:20:12 +03:00
Andrew Turner
d3aabde979 Have posixshm_test ask the kernel for the page size
It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

Reviewed by:	markj, kib, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34961
2022-04-20 14:44:52 +01:00
Andrew Turner
05d173587b Fill the page size array in one posix shm test
The largepage_config posix shared memory test was failing on arm64 as
the page size array is never filled out. Fix this by calling
getpagesizes(3), via pagesizes.

Reviewed by:	markj, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34960
2022-04-20 13:38:05 +01:00
Kristof Provost
812839e5aa pf: allow the use of tables in ethernet rules
Allow tables to be used for the l3 source/destination matching.
This requires taking the PF_RULES read lock.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34917
2022-04-20 13:01:12 +02:00
Alan Somers
3a1b3c6a1e fusefs: correctly handle servers that report too much data written
During a FUSE_WRITE, the kernel requests the server to write a certain
amount of data, and the server responds with the amount that it actually
did write.  It is obviously an error for the server to write more than
it was provided, and we always treated it as such, but there were two
problems:

* If the server responded with a huge amount, greater than INT_MAX, it
  would trigger an integer overflow which would cause a panic.

* When extending the file, we wrongly set the file's size before
  validing the amount written.

PR:		263263
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D34955
2022-04-18 18:59:10 -06:00
Mark Johnston
b13ac67842 path_test: Verify that operations on unlinked files work
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-04-18 17:55:24 -04:00
Mark Johnston
333f668468 path_test: Correct the kevent test
Perhaps surprisingly, and contrary to the expectations of
path_test:path_event, NOTE_LINK events are not raised when a file is
unlinked.  Prior to commit bf13db086b, the test happened to work
because unlinking the file would cause the vnode to be recycled, and
EVFILT_VNODE knotes deliver an event with EV_EOF set when the vnode is
doomed.  Since the test did not verify the note type, the test
succeeded.  After commit bf13db086b, the vnode is not recycled after
being unlinked and so the test hangs.

Fix the test by waiting for NOTE_DELETE instead, and check that we got
the note that we expected.

Reported by:	Jenkins
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-04-18 11:45:45 -04:00
Alan Somers
155ac516c6 fusefs: validate servers' error values
Formerly fusefs would pass up the stack any error value returned by the
fuse server.  However, some values aren't valid for userland, but have
special meanings within the kernel.  One of these, EJUSTRETURN, could
cause a kernel page fault if the server returned it in response to
FUSE_LOOKUP.  Fix by validating all errors returned by the server.

Also, fix a data lifetime bug in the FUSE_DESTROY test.

PR:		263220
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	3 weeks
Sponsored by:	Axcient
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D34931
2022-04-15 13:57:32 -06:00
Li-Wen Hsu
4642a6fac2
Disable building kcov test on powerpcspe
It's also 32-bit and lacks support for the needed atomic operations.

Sponsored by:	The FreeBSD Foundation
2022-04-14 23:03:00 +08:00
David Bright
0966fb1b74 Extend the length of dirpath to fix failure in kyua test
When an overlength path is set as the temporary directory for test
case sys/audit/inter-process:shm_unlink_success, the test will fail,
e.g.

```
root@freebsd:/usr/tests/sys/audit # env TMPDIR=/var/tmp/tests/kyua kyua test inter-process:shm_unlink_success
inter-process:shm_unlink_success  ->  failed: shm_unlink.*fileforaudit.*return,success not found in auditpipe within the time limit  [10.452s]

Results file id is usr_tests_sys_audit.20220412-221852-924310
Results saved to /root/.kyua/store/results.usr_tests_sys_audit.20220412-221852-924310.db

0/1 passed (1 failed)
```

The root cause is that dirpath is defined too small to handle it.

Reviewers:	vangyzen, dab
Differential Revision:	https://reviews.freebsd.org/D34885
Submitted by:	Yongbo Yao (yongbo.yao@dell.com)
Sponsored by:	Dell Technologies
2022-04-12 09:23:56 -07:00
Andrew Turner
8d40ee599d Have path_test ask the kernel for the page size
It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

Sponsored by:	The FreeBSD Foundation
2022-04-07 15:59:38 +01:00
Andrew Turner
df696a2fb6 Have the coredump_phnum test ask for the page size
The page size may be dynamically selected on boot. Have the
coredump_phnum test helper ask the kernel for the correct value.

Sponsored by:	The FreeBSD Foundation
2022-04-07 15:59:32 +01:00
Andrew Turner
1b7d882f00 Enable the kcov tests on supported architectures
i386 and 32-bit powerpc lack support for the needed atomic operations
in userspace.

Sponsored by:	The FreeBSD Foundation
2022-04-07 14:31:51 +01:00
Andrew Turner
41e6d2091c Enable subr_physmem_test on supported architectures
Only build where it's supported.

While here add support for amd64 to help with testing.

Sponsored by:	The FreeBSD Foundation
2022-04-07 14:31:51 +01:00
Alan Somers
3227325366 fusefs: fix two bugs regarding VOP_RECLAIM of the root inode
* We never send FUSE_LOOKUP for the root inode, since its inode number
  is hard-coded to 1.  Therefore, we should not send FUSE_FORGET for it,
  lest the server see its lookup count fall below 0.

* During VOP_RECLAIM, if we are reclaiming the root inode, we must clear
  the file system's vroot pointer.  Otherwise it will be left pointing
  at a reclaimed vnode, which will cause future VOP_LOOKUP operations to
  fail.  Previously we only cleared that pointer during VFS_UMOUNT.  I
  don't know of any real-world way to trigger this bug.

MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D34753
2022-04-06 16:16:52 -06:00
Andrew Turner
d8819d88af Disable the physmem test for now
It fails to build on at least i386
2022-04-06 15:02:10 +01:00
Andrew Turner
d8bff5b67c Handle non-page aligned/sized memory in physmem
In some configurations the firmware may pass memory regions that are
not page sized or aligned, e.g. when using 16k pages on arm64. If this
is the case we will calculate many small regions because the alignment
is applied before being inserted. As we round the start up and end down
this will leave a 1 page hole between what should have been a single
region.

Fix by keeping the original alignment until we are just about to insert
the region into the avail array.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34694
2022-04-06 14:13:29 +01:00
Andrew Turner
8c99dfed54 Port subr_physmem to userspace and add tests
These give us some confidience we haven't broken anything in early
boot code that may be running before the console.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34691
2022-04-06 14:13:05 +01:00
Kristof Provost
9bb06778f8 pf: support listing ethernet anchors
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Kristof Provost
3468cd95ca pf: ether l3 rules can only use addresses
Disallow the use of tables in ethernet rules. Using tables requires
taking the PF_RULES lock. Moreover, the current table code isn't ready
to deal with ethernet rules.

Disallow their use for now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-25 11:13:47 +01:00
Kristof Provost
d234b011a8 netinet tests: only log critical errors from scapy
See also a26e895f3d.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-17 23:34:12 +01:00
Kristof Provost
3c3a19d1f4 pf tests: Test retrieving nested nat-anchors
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-17 22:37:06 +01:00
Kristof Provost
d58d2e403d pf tests: Test setting and retrieving nested anchors
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-17 22:37:06 +01:00
Kristof Provost
734782a781 pf tests: Test new L3 inspection for pf 'ether' rules
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34483
2022-03-14 22:43:38 +01:00
John Baldwin
18207579a2 module_test: Fix some assignments to errno intended to be tests.
Reported by:	vangyzen
Reviewed by:	vangyzen, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34528
2022-03-14 14:05:05 -07:00
Li-Wen Hsu
8e03a75086
Skip sys.geom.class.multipath.failloop.failloop if dtrace fails to run
This test case depends on dtrace and sometimes gets affected if dtrace
has issues.  Make it report skipped instead of failure when dtrace fails
to run.

Sponsored by:	The FreeBSD Foundation
2022-03-08 18:12:40 +08:00
Mark Johnston
d7412bcac8 gmultipath tests: Re-enable the failloop test in CI
Sponsored by:	The FreeBSD Foundation
2022-03-07 10:43:19 -05:00
Mark Johnston
3a01dcc99f tests: Fix the test plan for closefrom_test
Fixes:	f3f3e3c44d ("fd: add close_range(..., CLOSE_RANGE_CLOEXEC)")
Reported by:	Jenkins
2022-03-06 12:57:40 -05:00
John Baldwin
5a1de9c25d Add simple kyua tests for the mod* system calls.
Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34417
2022-03-03 17:51:45 -08:00
Mateusz Guzik
f3f3e3c44d fd: add close_range(..., CLOSE_RANGE_CLOEXEC)
For compatibility with Linux.

MFC after:	3 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D34424
2022-03-03 17:21:58 +00:00
Kristof Provost
0d88926740 pf tests: extend ether test to verify mac address masks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
fdadb00682 pf tests: Ensure 'pfctl -F ethernet' works
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:07 +01:00
Kristof Provost
93b64cdc59 pf tests: slightly more complect captive portal setup
Combine anchor, dummynet and rdr to produce a more complex captive
portal setup.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32484
2022-03-02 17:00:07 +01:00
Kristof Provost
d1702bd1c3 pf tests: basic test for ether anchors
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32483
2022-03-02 17:00:07 +01:00
Kristof Provost
87a89d6e14 pfctl: support lists of mac addresses
Teach the 'ether' rules to accept { mac1, mac2, ... } lists, similar to
the lists of interfaces or IP addresses we already supported for layer 3
filtering.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32481
2022-03-02 17:00:07 +01:00
Kristof Provost
ab1868a7d1 pf tests: test match keyword and dummynet
Ensure that the 'match' keyword works with dummynet

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32480
2022-03-02 17:00:06 +01:00
Kristof Provost
0faafc2185 pf tests: test dummynet for ether traffic
Test that we can set dummynet information on L2, which is processed by
L3 later (assuming it's not overruled by L3 rules, of course).

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32223
2022-03-02 17:00:06 +01:00
Kristof Provost
feefb5625b pf tests: Test ether direction
Test that we correctly match inbound ('in') or outbound ('out') Ethernet
packets.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31747
2022-03-02 17:00:05 +01:00
Kristof Provost
792d7a5630 pf tests: Basic captive portal like test
Use the ether rules to selectively (i.e. per MAC address) redirect
certain connections. Test that tags carry over to the layer-3 pf code.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31746
2022-03-02 17:00:05 +01:00
Kristof Provost
4ffb7d1300 pf tests: Test EtherType filtering
Test filtering packets by their EtherType (i.e. ARP/IPv4/IPv6/...).

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31745
2022-03-02 17:00:05 +01:00
Kristof Provost
3a04f1d1ed pf tests: Test MAC address negation
Test that we can express 'ether block from ! 00:01:02:03:04:05'.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31744
2022-03-02 17:00:04 +01:00
Kristof Provost
d6fc3ee2e7 pf tests: MAC address filtering test
Test the MAC address filtering capability in the new 'ether' feature in
pf.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31743
2022-03-02 17:00:04 +01:00
Ed Maste
f27fb06cad zfs: Update test format strings to match variable typtes
And drop stray 'd' from the end of some printed numbers.  I assume this
was the result of someone thinking u is a printf length modifier for d,
not a format specifier itself.

Reviewed by:	kevans, rew
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34387
2022-03-01 12:21:40 -05:00
Alan Somers
e8553be9bc fusefs: fix a cached attributes bug during directory rename
When renaming a directory into a different parent directory, invalidate
the cached attributes of the new parent.  Otherwise, stat will show the
wrong st_nlink value.

MFC after:	1 week
Reviewed by:	ngie
Differential Revision: https://reviews.freebsd.org/D34336
2022-02-24 14:07:25 -07:00
Li-Wen Hsu
d33158471a
Temporarily skip sys.geom.class.multipath.failloop.failloop in CI
This test case uses `dtrace -c` but it has some issues at the moment so
disable it until dtrace fixed.

From markj:

This is the CTF type ID limit which has come up quite a few times
lately.  It'll be fixed with the introduction of CTFv3.

PR:		258763
Sponsored by:	The FreeBSD Foundation
2022-02-24 06:28:24 +08:00
Andrew Turner
6713be3159 Add NT_ARM_ADDR_MASK
This can be used by debuggers to find which bits in a virtual address
should be masked off to get a canonical address. This is currently used
by the Pointer Authentication Code support to get its mask. It could also
be used if we support Top Byte Ignore for the same purpose.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34302
2022-02-22 17:10:35 +00:00
Arka Sharma
766c2466ff mmap map_at_zero test: handle W^X
Use kern.elfXX.allow_wx to decide whether to map W+X or W-only memory.

Future work could expand this test to add an "allow_wx" axis to the
test matrix, but I would argue that a separate test should be written,
since that's orthogonal to map_at_zero.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-02-21 09:43:42 -06:00
Kristof Provost
7d3fc84b2d pf tests: Test per-anchor tables
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-02-17 14:13:50 +01:00
Kristof Provost
7f55a9b490 pf tests: remove a stray 'set -x'
'set -x' is very useful when debugging tests, but does not need to be
left in.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-02-17 13:40:41 +01:00
Kristof Provost
31566b98b8 vlan tests: fix bpf_pcp test
We now allow net.link.vlan.mtag_pcp to be set per-vnet, so we must set
it in the correct vnet, not on the host.
2022-02-15 07:53:30 +01:00
Kristof Provost
24360d8375 pf tests: Basic 'set prio' test
The ability to set VLAN PCP from pf was introduced in 3e248e0fb4, but
never had a test added.

Create a basic setup to set the PCP to an arbitrary value and use
tcpdump to check it's actually set.

MFC after:	1 week
2022-02-14 22:51:10 +01:00
Alan Somers
0b6a34acda [skip ci] fusefs: delete a stray comment from 91972cfcdd
MFC after:	3 days
2022-02-12 09:27:56 -07:00
John Baldwin
dba02df30d Cast pointer to uintptr_t to avoid alignment warnings.
Both struct ip and struct udphdr both have an aligment of 2, but the
cast from struct ip to a uint32_t pointer confused GCC 9 into raising
the required alignment to 4 and then raising a
-Waddress-of-packed-member error when casting to struct udphdr.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31941
2022-02-11 16:04:52 -08:00
Mark Johnston
5de79eeddb ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode
There was nothing preventing one from sending an empty fragment on an
arbitrary KTLS TX-enabled socket, but ktls_frame() asserts that this
could not happen.  Though the transmit path handles this case for TLS
1.0 with AES-CBC, we should be strict and allow empty fragments only in
modes where it is explicitly allowed.

Modify sosend_generic() to reject writes to a KTLS-enabled socket if the
number of data bytes is zero, so that userspace cannot trigger the
aforementioned assertion.

Add regression tests to exercise this case.

Reported by:	syzkaller
Reviewed by:	gallatin, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34195
2022-02-08 12:40:41 -05:00
Andrew Turner
31cf95cec7 Stop single stepping in signal handers on arm64
We should clear the single step flag when entering a signal hander and
set it when returning. This fixes the ptrace__PT_STEP_with_signal test.

While here add support for userspace to set the single step bit as on
x86. This can be used by userspace for self tracing.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34170
2022-02-07 15:03:23 +00:00
Dimitry Andric
c9cabf9aa6 Explicitly include semaphore.h for struct _sem in fusefs setattr test
In libc++'s __threading_support header the semaphore.h header was
implicitly included, but from version 14 onwards, this is no longer the
case, resulting in compile errors:

tests/sys/fs/fusefs/setattr.cc:740:8: error: variable has incomplete type 'sem_t' (aka '_sem')
        sem_t sem;
              ^
tests/sys/fs/fusefs/utils.hh:33:8: note: forward declaration of '_sem'
struct _sem;
       ^

MFC after:	3 days
2022-02-06 17:07:28 +01:00
Kristof Provost
34478b73bf pf tests: Only do post-test logging when specifically enabled
The pf tests have the ability to log state information (pf rules, pf
states, interfaces, ...) on exit (i.e. on success or on error).
This is useful, but only in specific cases. When it's not needed it may
get in the way of clear output.

Test scripts can add 'debug' to the pft_init call to enable this for the
specified test.

Reviewed by:	brd
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34133
2022-02-05 10:31:51 +01:00
Kristof Provost
1094189965 pf tests: Test adding counters to an existing table
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34132
2022-02-05 10:29:34 +01:00
Warner Losh
356deeb2e7 kyua/qemu: When running in qemu, don't teset sendfile
qemu's bsd-user doesn't implement sendfile, so just skip those tests
that use it.

Sponsored by:		Netflix
2022-02-02 14:27:51 -07:00
John Baldwin
978c7e2247 tests/sys/ses: Use ANSI C definition for has_ses.
This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.
2022-02-01 13:25:47 -08:00
Mark Johnston
773e3a71b2 pf: Initialize pf_kpool mutexes earlier
There are some error paths in ioctl handlers that will call
pf_krule_free() before the rule's rpool.mtx field is initialized,
causing a panic with INVARIANTS enabled.

Fix the problem by introducing pf_krule_alloc() and initializing the
mutex there.  This does mean that the rule->krule and pool->kpool
conversion functions need to stop zeroing the input structure, but I
don't see a nicer way to handle this except perhaps by guarding the
mtx_destroy() with a mtx_initialized() check.

Constify some related functions while here and add a regression test
based on a syzkaller reproducer.

Reported by:	syzbot+77cd12872691d219c158@syzkaller.appspotmail.com
Reviewed by:	kp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34115
2022-01-31 16:14:00 -05:00
Andrew Turner
548a2ec49b Add PT_GETREGSET
This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19831
2022-01-27 11:40:34 +00:00
Kristof Provost
a95fcd81d5 netpfil tests: re-enable dummynet tests
These had been disabled due to panics with queued packets keeping
pointers (in m->m_pkthdr.rcvif) to removed interfaces.
This issue has been resolved in 165746f4e4, so the tests can be run
again.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-01-27 10:16:21 +01:00
Kristof Provost
74e6b014b4 netpfil tests: test removing interfaces with pending dummynet packets
Dummynet queues packets with an associated struct ifnet pointer. Ensure
that things do not explode if that interface goes away with packets
still in the queue.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33065
2022-01-27 09:36:09 +01:00
Gleb Smirnoff
929ff66ad3 tests/sys/net/routing: remove bandaid against old epair(4) panic 2022-01-26 21:58:43 -08:00
Gleb Smirnoff
942d05e3b8 tests/sys/net/epair: don't leak the interface after the test 2022-01-26 21:08:50 -08:00
Li-Wen Hsu
2c449a4c5a
Fix test of ses(4) when there is no SES device exists
glob(3) returns GLOB_NOMATCH if GLOB_NOCHECK or GLOB_NOMAGIC flag is not
passed so ATF_REQUIRE_EQ(r, 0) will cause a precondition check failure if no
/dev/ses* exists.

Remove calling of atf_tc_skip() in ATF_TC_CLEANUP() because it would let
the clean up procedure unfinish.

While here, fix a set-but-not-used warning.

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D34056
2022-01-27 07:11:17 +08:00
Kyle Evans
e5b431fc0c tests: add a basic test for argc == 0
The kernel should reject such exec()s now, early on. Instead of adding
the needed boilerplate to write a test in C, just add an -n argument for
"(n)ull argv" to the execve helper and exec this other helper that just
exits silently with argv count.

Reviewed by:	emaste, kib, markj (all previous version)
Differential Revision:	https://reviews.freebsd.org/D34045
2022-01-26 13:40:27 -06:00
Gleb Smirnoff
80fc25025f tests/net*: destroy interface from inside a jail
There is no guarentee that upon return of 'jail -r' all jail resources
will be released.  The test suite used to rely on that.  Recent changes
to the PCB zones made jails delay releasing their resources, which ended
with interface leak in the test suite.

Fix that by executing 'ifconfig foo0 destroy' inside the jail, instead
of doing 'jail -r' and expecting interfaces to pop up back immediately
in the parent jail.

Reviewed by:		kp
Differential revision:	https://reviews.freebsd.org/D33942
2022-01-24 21:08:03 -08:00
Thomas Steen Rasmussen
4a178afb4a tests/netinet: add test for IPv6 NS and CARP
PR:			193280
Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D33859
2022-01-24 21:02:47 -08:00
Alan Somers
eea7c61590 Add tests for ses(4)
The tests require SES hardware.  Without it, the test cases will be
skipped.

Reviewed by:	ken
Differential Revision: https://reviews.freebsd.org/D31809
Sponsored by:	Axcient
MFC after:	2 weeks
2022-01-19 12:43:51 -07:00
Alan Somers
89d57b94d7 fusefs: implement VOP_DEALLOCATE
MFC after:	Never
Reviewed by:	khng
Differential Revision: https://reviews.freebsd.org/D33800
2022-01-18 21:13:02 -07:00
Cy Schubert
64e33c5cb1 Revert "wpa: Import wpa 2.10."
This reverts commit 5eb81a4b40, reversing
changes made to c6806434e7 and
this reverts commit 679ff61123.

What happend is git rebase --rebase-merges doesn't do what is expected.
2022-01-18 08:10:33 -08:00
Cy Schubert
5eb81a4b40 wpa: Import wpa 2.10.
The long awaited hostapd 2.10 is finally here.

MFC after:	3 weeks
2022-01-18 07:45:39 -08:00
Mark Johnston
6393594b03 copyin tests: Use the KERN_PROC_VM_LAYOUT sysctl to fetch layout info
... rather than using the KERN_PROC_PS_STRINGS value to derive the top
of the user address space.

Reviewed by:	kib
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33708
2022-01-17 16:12:43 -05:00
Cy Schubert
03f33dd077 wpa: Import wpa 2.10
The long awaited wpa 2.10 is finally here.
2022-01-17 07:48:49 -08:00
Kristof Provost
4ca4193760 pf tests: Provoke failure in pf_ioctl_addrule
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-01-16 09:04:59 +01:00
Doug Moore
84e2ae64c5 vm_reserv: use enhanced bitstring for popmaps
vm_reserv.c uses its own bitstring implemenation for popmaps. Using
the bitstring_t type from a standard header eliminates the code
duplication, allows some bit-at-a-time operations to be replaced with
more efficient bitstring range operations, and, in
vm_reserv_test_contig, allows bit_ffc_area_at to more efficiently
search for a big-enough set of consecutive zero-bits.

Make bitstring changes improve the vm_reserv code.  Define a bit_ntest
method to test whether a range of bits is all set, or all clear.
Define bit_ff_at and bit_ff_area_at to implement the ffs and ffc
versions with a parameter to choose between set- and clear- bits.
Improve the area_at implementation.  Modify the bit_nset and
bit_nclear implementations to allow code optimization in the cases
when start or end are multiples of _BITSTR_BITS.

Add a few new cases to bitstring_test.

Discussed with:	alc
Reviewed by:	markj
Tested by:	pho (earlier version)
Differential Revision:	https://reviews.freebsd.org/D33312
2022-01-12 11:03:53 -06:00
Cy Schubert
7b54fad807 wpa: Import wpa_supplicant/hostapd commit b26f5c0fe
This is the December/January update to vendor/wpa committed upstream
2021-12-13.
2022-01-05 22:05:32 -08:00
Mark Johnston
321e586e46 posixshm tests: Fix occasional largepage_mprotect failures
largepage_mprotect maps a superpage and later extends the mapping.  This
occasionally fails with ASLR disabled.  To fix this, first try to
reserve a sufficiently large virtual address region.

Reported by:	Jenkins
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-01-03 13:00:50 -05:00
Alan Somers
398c88c758 fusefs: implement VOP_ALLOCATE
Now posix_fallocate will be correctly forwarded to fuse file system
servers, for those that support it.

MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33389
2021-12-31 21:05:28 -07:00
Alan Somers
1613087a81 fusefs: fix .. lookups when the parent has been reclaimed.
By default, FUSE file systems are assumed not to support lookups for "."
and "..".  They must opt-in to that.  To cope with this limitation, the
fusefs kernel module caches every fuse vnode's parent's inode number,
and uses that during VOP_LOOKUP for "..".  But if the parent's vnode has
been reclaimed that won't be possible.  Previously we paniced in this
situation.  Now, we'll return ESTALE instead.  Or, if the file system
has opted into ".." lookups, we'll just do that instead.

This commit also fixes VOP_LOOKUP to respect the cache timeout for ".."
lookups, if the FUSE file system specified a finite timeout.

PR:		259974
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33239
2021-12-31 20:38:27 -07:00
Alan Somers
8d99a6b91b fusefs: move common code from forget.cc to utils.cc
MFC after:	2 weeks
2021-12-31 20:38:20 -07:00
Alan Somers
19ab361045 fusefs: in the tests, always assume debug.try_reclaim_vnode is available
In an earlier version of the revision that created that sysctl (D20519)
the sysctl was gated by INVARIANTS, so the test had to check for it.
But in the committed version it is always available.

MFC after:	2 weeks
2021-12-31 18:04:52 -07:00
Alan Somers
5169832c96 fusefs: copy_file_range must update file timestamps
If FUSE_COPY_FILE_RANGE returns successfully, update the atime of the
source and the mtime and ctime of the destination.

MFC after:	2 weeks
Reviewers:	pfg
Differential Revision: https://reviews.freebsd.org/D33159
2021-12-31 17:43:57 -07:00
Alan Somers
13d593a5b0 Fix a race in fusefs that can corrupt a file's size.
VOPs like VOP_SETATTR can change a file's size, with the vnode
exclusively locked.  But VOPs like VOP_LOOKUP look up the file size from
the server without the vnode locked.  So a race is possible.  For
example:

1) One thread calls VOP_SETATTR to truncate a file.  It locks the vnode
   and sends FUSE_SETATTR to the server.
2) A second thread calls VOP_LOOKUP and fetches the file's attributes from
   the server.  Then it blocks trying to acquire the vnode lock.
3) FUSE_SETATTR returns and the first thread releases the vnode lock.
4) The second thread acquires the vnode lock and caches the file's
   attributes, which are now out-of-date.

Fix this race by recording a timestamp in the vnode of the last time
that its filesize was modified.  Check that timestamp during VOP_LOOKUP
and VFS_VGET.  If it's newer than the time at which FUSE_LOOKUP was
issued to the server, ignore the attributes returned by FUSE_LOOKUP.

PR:		259071
Reported by:	Agata <chogata@moosefs.pro>
Reviewed by:	pfg
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D33158
2021-12-31 17:38:42 -07:00
Lutz Donnerhacke
2c733b50c5 tests/libalias: Portrange
Test ranges of allowed ports for aliasing.
 - Explicit default like ipfw(8) is doing
 - Regular range
 - Exhausting a very small range
 - Recovery

Includes a fix of an utility macro, which was not used before.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31012
2021-12-27 14:54:57 +01:00
Dimitry Andric
46aec7fae4 tests/libalias: Make inline functions static inline
In C, plain inline functions should never be used: they should be
declared either static inline or extern inline. In this case, they are
clearly meant to be static inline.

MFC after:	3 days
2021-12-20 10:52:25 +01:00
Mark Johnston
fff0ae77b9 tests: Add some regression tests for a couple of KERN_PROC_* sysctls
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2021-12-17 13:10:52 -05:00
Mark Johnston
ee5686c614 ktls: Add a regression test to exercise socket error handling
Prior to commit 916c61a5ed ("Fix handling of errors from
pru_send(PRUS_NOTREADY)") this test triggered a kernel panic due to an
mbuf double free.

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33517
2021-12-17 13:10:22 -05:00
Kristof Provost
cfca19c28e tests: sys.netpfil.pf.pfsync.defer fails in CI
sys.netpfil.pf.pfsync.defer has been failing for a while in CI now.
Disable it for now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-16 13:09:59 +01:00
Warner Losh
7821ef4487 tests: sys.net.if_bridge_test.span is failing in CI
sys.net.if_bridge_test.span has been failing in CI for a while
now. Disable it until this can be resolved.

PR:		260461
Sponsored by:	Netflix
2021-12-15 18:32:37 -07:00
Warner Losh
8b44e26df3 tests: sys.netpfil.pf.forward.v6 fails in CI
sys.netpfil.pf.forward.v6 has been failing in CI. File a bug and disable
until it can be resolved.

PR:		260460
Sponsored by:	Netflix
2021-12-15 18:32:37 -07:00
Warner Losh
0ab7c42e94 tests: sys.netpfil.pf.set_tos.v6 fails in CI
sys.netpfil.pf.set_tos.v6 has been failing for a while in CI now.  File
a bug and disable.

PR:		260459
Sponsored by:	Netflix
2021-12-15 18:32:37 -07:00
Warner Losh
300f4be447 tests: sys.netpfil.pf.killstate.v6 fails in CI
sys.netpfil.pf.killstate.v6 has been failing in CI for a while, file a
bug and disable.

PR:		260458
Sponsored by:	Netflix
2021-12-15 18:32:37 -07:00
John Baldwin
05a1d0f5d7 ktls: Support for TLS 1.3 receive offload.
Note that support for TLS 1.3 receive offload in OpenSSL is still an
open pull request in active development.  However, potential changes
to that pull request should not affect the kernel interface.

Reviewed by:	hselasky
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33007
2021-12-14 11:01:05 -08:00
Kristof Provost
08851be187 ndp tests: fix cleanup
Fix the cleanup function name so we actually remove our test jail and
interfaces.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-13 18:14:59 +01:00
Kristof Provost
4826406b30 pf tests: log additional information when a test ends
Log information from the running jails (routing, interfaces and pf) as
well as interfaces on the host.

This information is expected to be useful in debugging test failures.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-13 15:54:03 +01:00
Konstantin Belousov
b49b6e0f95 swapon(8): adapt to the new swapoff(2) interface
also fix test sys/audit/administrative.c.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33343
2021-12-09 02:48:59 +02:00
Alan Somers
41ae9f9e64 fusefs: invalidate the cache during copy_file_range
FUSE_COPY_FILE_RANGE instructs the server to write data to a file.
fusefs must invalidate any cached data within the written range.

PR:		260242
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33280
2021-12-06 21:41:50 -07:00
Alan Somers
25927e068f fusefs: correctly handle an inode that changes file types
Correctly handle the situation where a FUSE server unlinks a file, then
creates a new file of a different type but with the same inode number.
Previously fuse_vnop_lookup in this situation would return EAGAIN.  But
since it didn't call vgone(), the vnode couldn't be reused right away.
Fix this by immediately calling vgone() and reallocating a new vnode.

This problem can occur in three code paths, during VOP_LOOKUP,
VOP_SETATTR, or following FUSE_GETATTR, which usually happens during
VOP_GETATTR but can occur during other vops, too.  Note that the correct
response actually doesn't depend on whether the entry cache has expired.
In fact, during VOP_LOOKUP, we can't even tell.  Either it has expired
already, or else the vnode got reclaimed by vnlru.

Also, correct the error code during the VOP_SETATTR path.

PR:		258022
Reported by:	chogata@moosefs.pro
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33283
2021-12-06 21:36:46 -07:00
Kristof Provost
5fecc5a79a dummynet tests: disable for now
Disable the dummynet tests when running the ci tests. This avoids
running into the panic described in https://reviews.freebsd.org/D33064
(where an interface is removed but a dummynet queued packet still has a
pointer to it).

These tests can be re-enabled when the work in
https://reviews.freebsd.org/D33267 lands.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-06 18:15:24 +01:00
Kristof Provost
60a3a371af pf tests: more thorough pfsync defer test
Add a somewhat more extensive pfsync defer mode test. Ensure that pfsync
actually delays the state creating packet until after it has sent the
pfsync update and given the peer time to create the state.

Ideally the test should validate the pfsync state update and generate an
ack message, but to keep the test simple we rely on the timeout of the
deferred packet instead.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33245
2021-12-06 13:25:14 +01:00
Stefan Eßer
5e04571cf3 sys/bitset.h: reduce visibility of BIT_* macros
Add two underscore characters "__" to names of BIT_* and BITSET_*
macros to move them to the implementation name space and to prevent
a name space pollution due to BIT_* macros in 3rd party programs with
conflicting parameter signatures.

These prefixed macro names are used in kernel header files to define
macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h.

If C programs are built with either -D_KERNEL (automatically passed
when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET
(or this macros is defined in the source code before including the
bitset macros), then all macros are made visible with their previous
names, too. E.g., both __BIT_SET() and BIT_SET() are visible with
either of _KERNEL or _WANT_FREEBSD_BITSET defined.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

As a work-around, parts of shed.h have been made conditional and
depend on _WITH_CPU_SET_T being set when sched.h is included.
Ports that expect the full functionality provided by sched.h need
to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if
BIT_* macros are defined in that program, too.

This patch set makes all of sched.h visible again without this
parameter being passed and without any name space pollution due
to BIT_* macros becoming visible when sched.h is included.

This patch set will be backported to the STABLE branches, but ports
will need to use -D_WITH_CPU_SET_T as long as there are supported
releases that do not contain these patches.

Reviewed by:	kib, markj
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D33235
2021-12-05 23:00:25 +01:00
Mitchell Horne
d99a40e5ba Remove riscv workaround in sys.netgraph.hub.loop test
The test case now passes on this architecture. This reverts commits
d5fd5cdc06 and 168b579a48.

Reviewed by:	lwhsu, imp
Differential Revision:	https://reviews.freebsd.org/D33252
2021-12-05 11:12:40 -04:00
Alan Somers
c2d342c509 fusefs: better debugging for FUSE_RENAME in the tests
MFC after:	2 weeks
2021-12-02 20:26:27 -07:00
Cy Schubert
56f32b0e4c wpa: Import wpa_supplicant/hostapd commit 14ab4a816
This is the November update to vendor/wpa committed upstream 2021-11-26.
2021-12-01 08:06:47 -08:00
Alan Somers
d109559ddb fusefs: fix 32-bit build of the tests after 91972cfcdd
MFC after:	2 weeks
MFC with:	91972cfcdd
2021-11-28 20:35:42 -07:00
Alan Somers
91972cfcdd fusefs: update atime on reads when using cached attributes
When using cached attributes, whether or not the data cache is enabled,
fusefs must update a file's atime whenever it reads from it, so long as
it wasn't mounted with -o noatime.  Update it in-kernel, and flush it to
the server on close or during the next setattr operation.

The downside is that close() will now frequently trigger a FUSE_SETATTR
upcall.  But if you care about performance, you should be using
-o noatime anyway.

MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33145
2021-11-28 18:53:31 -07:00
Alan Somers
65d70b3bae fusefs: fix copy_file_range when extending a file
When copy_file_range extends a file, it must update the cached file
size.

MFC after:	2 weeks
Reviewed by:	rmacklem, pfg
Differential Revision: https://reviews.freebsd.org/D33151
2021-11-28 18:35:58 -07:00
Warner Losh
09f1ead230 Fix copyright to be like all my others in the tree 2021-11-23 21:21:18 -07:00
Warner Losh
afc5ab870d Basic signal tests: Can we deliver a signal?
Basic signal tests that tests can we deliver a signal via raise() and
can we deliver one via SIGALARM asynchronously.

In addition, tests whether or not on ARM T32 (Thumb) code can interrupt
A32 (normal) and vice versa.

While this test is aimed at ensuring basic qemu signals are working,
it's good to have in the base.

Sponsored by:		Netflix
Discussed with:		kevans, cognet
Differential Revision:	https://reviews.freebsd.org/D33078
2021-11-23 13:37:14 -07:00
Ed Maste
8ec4c5dae3 Fix coredump_phnum test with ASLR enabled by default
coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR:		259970
Reported by:	lwhsu, mw
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33070
2021-11-21 12:57:38 -05:00
Kristof Provost
67573b7a39 net tests: fix if_stf:6to4
This test needs to have the loopback interface enabled, or route lookups
for our own IP addresses will fail.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33041
2021-11-20 19:29:02 +01:00
Kristof Provost
2610dcc1a5 net tests: 6rd to 6rd test
Test traffic between 6rd hosts, without border relay involvement.

PR:		253328
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33040
2021-11-20 19:29:02 +01:00
Kristof Provost
e1b95017d2 net tests: 6rd test for if_stf
Basic test case for 6rd.

PR:		253328
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33039
2021-11-20 19:29:02 +01:00
John Baldwin
694c708d6a ktls tests: Check the return values of close().
Suggested by:	markj
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33004
2021-11-16 09:56:15 -08:00
John Baldwin
d71830cdf0 ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
The TLS header length field is set by the kernel, so if it is
incorrect that is an indication of a kernel bug, not an internal error
in the tests.

Prompted by:	markj (comment in an earlier review)
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33003
2021-11-16 09:56:15 -08:00
John Baldwin
83a54b582f ktls: Add tests ensuring unsupported receive cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32982
2021-11-15 11:32:49 -08:00
John Baldwin
233ce578a4 ktls: Add tests ensuring invalid receive cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32981
2021-11-15 11:32:15 -08:00
John Baldwin
3e7f8a8da2 ktls: Add simple receive tests of kernel TLS.
Similar to the simple transmit tests added in
a10482ea74, these tests test the kernel
TLS functionality directly by manually encrypting TLS records using
randomly generated keys and writing them to a socket to be processed
by the kernel.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32980
2021-11-15 11:31:16 -08:00
John Baldwin
d1c369f926 ktls: Add tests ensuring various invalid cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32843
2021-11-15 11:30:48 -08:00
John Baldwin
0ff2a12ae3 ktls: Add tests for sending empty fragments for TLS 1.0 connections.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32841
2021-11-15 11:28:12 -08:00
John Baldwin
44265dc3da ktls: Add padding tests for AES-CBC MTE cipher suites.
For each AES-CBC MTE cipher suite, test sending records with 1 to 16
bytes of payload.  This ensures that all of the potential padding
values are covered.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32840
2021-11-15 11:26:45 -08:00
Gleb Smirnoff
6913bf4c3d tests/divert: fix after 2ce85919bb (IP source address validation)
Just make the test packet more legitimate.

Reviewed by:	melifaro
2021-11-12 11:20:06 -08:00
Kristof Provost
2de49deeca pf tests: Test PR259689
We didn't populate dyncnt/tblcnt, so `pfctl -sr -vv` might not have the
table element count.

PR:		259689
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32893
2021-11-10 11:27:22 +01:00
Ed Maste
e818178e3a tests: do not build ktls_test if WITHOUT_OPENSSL
ktls_test requires libcrypto to build, and fails if it is not available
(which is the case when building WITHOUT_OPENSSL).

Reported by:	Michael Dexter, Build Option Survey
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32895
2021-11-09 13:47:20 -05:00
Kristof Provost
eb5e0755f7 net tests: basic if_stf test
Test the 6to4 code.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32850
2021-11-09 09:39:54 +01:00
Kristof Provost
6e0755b37b net tests: basic if_gif(4) test case
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32836
2021-11-08 12:00:00 +01:00
Kornel Duleba
197ff4c35b ossl: Add support for AES-CBC cipher
AES-CBC OpenSSL assembly is used underneath.
The glue layer(ossl_aes.c) is based on CHACHA20 implementation.
Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic
does not have a fallback implementation in case CPU doesn't
support required instructions.
Because of that CPU caps are checked during initialization and AES
support is advertised only if available.
The feature is available on all architectures that ossl supports:
i386, amd64, arm64.

The biggest advantage of this patch over existing solutions
(aesni(4) and armv8crypto(4)) is that it supports SHA,
allowing for ETA operations.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb (previous version)
Differential revision:	https://reviews.freebsd.org/D32099
2021-11-08 10:53:31 +01:00
Wojciech Macek
200bc58953 Revert "ossl: Add support for AES-CBC cipher"
This reverts commit 849faf4e0b.
2021-11-06 17:46:01 +01:00
Kornel Duleba
849faf4e0b ossl: Add support for AES-CBC cipher
AES-CBC OpenSSL assembly is used underneath.
The glue layer(ossl_aes.c) is based on CHACHA20 implementation.
Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic
does not have a fallback implementation in case CPU doesn't
support required instructions.
Because of that CPU caps are checked during initialization and AES
support is advertised only if available.
The feature is available on all architectures that ossl supports:
i386, amd64, arm64.

The biggest advantage of this patch over existing solutions
(aesni(4) and armv8crypto(4)) is that it supports SHA,
allowing for ETA operations.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D32099
2021-11-06 09:08:44 +01:00
Kristof Provost
508161111d pf tests: basic test for ridentifier
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32751
2021-11-05 09:39:56 +01:00
Kristof Provost
11703705c2 pf tests: route_to:icmp_nat_head requires scapy
Document the requirement so the test is skipped if scapy is not
installed.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-03 10:35:09 +01:00
John Baldwin
a10482ea74 ktls: Add simple transmit tests of kernel TLS.
Note that these tests test the kernel TLS functionality directly.
Rather than using OpenSSL to perform negotiation and generate keys,
these tests generate random keys send data over a pair of TCP sockets
manually decrypting the TLS records generated by the kernel.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32652
2021-11-01 11:28:10 -07:00
Marius Halden
847b0d07c4 carp tests: negative demotion
PR:		259528
Reviewed by:	donner
MFC after:	3 weeks
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32760
2021-11-01 17:08:23 +01:00
Kristof Provost
4ee0f6d874 netpfil tests: dummynet+NAT test for pf
Ensure that NAT still works as expected when combined with dummynet.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32666
2021-10-28 10:41:17 +02:00
Kristof Provost
30276ef12c pf tests: test NAT-ed ICMP errors
Ensure that the ICMP error is returned with the correct
source and destination addresses.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32572
2021-10-22 09:52:17 +02:00
Mark Johnston
51425cb210 bitset: Reimplement BIT_FOREACH_IS(SET|CLR)
Eliminate the nested loops and re-implement following a suggestion from
rlibby.

Add some simple regression tests.

Reviewed by:	rlibby, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32472
2021-10-18 09:56:58 -04:00
Kristof Provost
914ec9c78d pf tests: ensure that $nr expansion is correct
Test the $nr expansion in labels is correct, even if the optimiser
reduces the rule count.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32489
2021-10-15 22:19:45 +02:00
Li-Wen Hsu
168b579a48
Fix RISC-V build
Fixes:	d5fd5cdc06
2021-10-14 23:20:12 +08:00
Li-Wen Hsu
d5fd5cdc06
Temporarily skip sys.netgraph.hub.loop on RISC-V in CI
This case panics kernel.

PR:		259157
Sponsored by:	The FreeBSD Foundation
2021-10-14 05:31:22 +08:00
Kyle Evans
7259ca3104 fifos: delegate unhandled kqueue filters to underlying filesystem
This gives the vfs layer a chance to provide handling for EVFILT_VNODE,
for instance.  Change pipe_specops to use the default vop_kqfilter to
accommodate fifoops that don't specify the method (i.e. all in-tree).

Based on a patch by Jan Kokemüller.

PR:		225934
Reviewed by:	kib, markj (both pre-KASSERT)
Differential Revision:	https://reviews.freebsd.org/D32271
2021-10-12 02:43:07 -05:00
Li-Wen Hsu
2d827c065a
Skip sys.net.if_lagg_test.status_stress in CI
This case panics the machine fairly often and we should run
stress tests separately.

Sponsored by:	The FreeBSD Foundation
2021-10-12 05:40:24 +08:00
Mitchell Horne
8babb5582e riscv: fix VM_MAXUSER_ADDRESS checks in asm routines
There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR:		257193
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31209
2021-10-07 18:12:30 -03:00
John Baldwin
668770dc7d crypto: Test all of the AES-CCM KAT vectors.
Previously, only test vectors which used the default nonce and tag
sizes (12 and 16, respectively) were tested.  This now tests all of
the vectors.  This exposed some additional issues around requests with
an empty payload (which wasn't supported) and an empty AAD (which
falls back to CIOCCRYPT instead of CIOCCRYPTAEAD).

- Make use of the 'ivlen' and 'maclen' fields for CIOGSESSION2 to
  test AES-CCM vectors with non-default nonce and tag lengths.

- Permit requests with an empty payload.

- Permit an input MAC for requests without AAD.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32121
2021-10-06 14:08:48 -07:00
Alan Somers
f44a448709 fusefs: fix intermittency in the dev_fuse_poll test
The DevFusePoll::access/select test would occasionally segfault.  The
cause was a file descriptor that was shared between two threads.  The
first thread would kill the second and close the file descriptor.  But
it was possible that the second would read the file descriptor before it
shut down.  That did not cause problems for kqueue, poll, or blocking
operation, but it triggered segfaults in select's macros.

MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D32142
2021-10-06 14:28:48 -06:00
Alan Somers
032a5bd55b fusefs: Fix a bug during VOP_STRATEGY when the server changes file size
If the FUSE server tells the kernel that a file's size has changed, then
the kernel must invalidate any portion of that file in cache.  But the
kernel can't do that during VOP_STRATEGY, because the file's buffers are
already locked.  Instead, proceed with the write.

PR:		256937
Reported by:	Agata <chogata@moosefs.pro>
Tested by:	Agata <chogata@moosefs.pro>
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D32332
2021-10-06 14:07:33 -06:00
Alan Somers
7430017b99 fusefs: fix a recurse-on-non-recursive lockmgr panic
fuse_vnop_bmap needs to know the file's size in order to calculate the
optimum amount of readahead.  If the file's size is unknown, it must ask
the FUSE server.  But if the file's data was previously cached and the
server reports that its size has shrunk, fusefs must invalidate the
cached data.  That's not possible during VOP_BMAP because the buffer
object is already locked.

Fix the panic by not querying the FUSE server for the file's size during
VOP_BMAP if we don't need it.  That's also a a slight performance
optimization.

PR:		256937
Reported by:	Agata <chogata@moosefs.pro>
Tested by:	Agata <chogata@moosefs.pro>
MFC after:	2 weeks
2021-10-06 14:07:33 -06:00
Mark Johnston
69f7649b71 gmultipath tests: Re-enable the failloop test in CI
PR:		258763
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-10-04 12:28:27 -04:00
Kyle Evans
2f4dbe279f kqueue: fix recent assertion
NOTE_ABSTIME may also have a zero timeout, which indicates that we
should still fire immediately as an absolute time in the past.  A test
has been added for this one as well.

Fixes:	9c999a259f ("kqueue: don't arbitrarily restrict long-past...")
Point hat:	kevans
Reported by:	syzbot+1c8d1154f560b3930042@syzkaller.appspotmail.com
2021-10-01 13:17:30 -05:00
Kyle Evans
9c999a259f kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME
NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected.  We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

Reviewed by:	kib, markj
Discussed with:	allanjude
Differential Revision:	https://reviews.freebsd.org/D32230
2021-09-30 21:31:24 -05:00
Kristof Provost
2f20d80692 pf tests: Basic adaptive mode syncookie test
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32139
2021-09-29 15:42:01 +02:00
Kristof Provost
dc0636636b pf tests: Basic syncookie test
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32138
2021-09-29 15:42:01 +02:00
Li-Wen Hsu
0b159faaca
Temporarily skip flaky tset cases under sys.aio.aio_test in CI
- sys.aio.aio_test.vectored_unaligned
- sys.aio.aio_test.vectored_zvol_poll

PR:		258766
Sponsored by:	The FreeBSD Foundation
2021-09-29 03:32:47 +08:00
Li-Wen Hsu
b9b5a4dd59
gmultipath failloop test: Put the dtrace sanity checker in right place
Check if dtrace excution is successful or not right after execution.

Sponsored by:	The FreeBSD Foundation
2021-09-29 02:38:34 +08:00
Li-Wen Hsu
38dac71d0a
Fix typo
Reported by:	swills
Sponsored by:	The FreeBSD Foundation
2021-09-29 02:28:01 +08:00
Li-Wen Hsu
819961c580
Temporarily skip sys.geom.class.multipath.failloop.failloop in CI
This test case uses `dtrace -c` but it has some issues at the moment

While here, add a checker for dtrace executes successfully or not to provide
a more informative error message.

PR:             258763
Sponsored by:   The FreeBSD Foundation
2021-09-29 02:02:27 +08:00
Alan Somers
7124d2bc3a fusefs: implement FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT
For file systems that allow it, fusefs will skip FUSE_OPEN,
FUSE_RELEASE, FUSE_OPENDIR, and FUSE_RELEASEDIR operations, a minor
optimization.

MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D32141
2021-09-26 21:57:29 -06:00
Mark Johnston
d7cf1b262f tests/sys/sys: Raise WARNS
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-09-24 11:31:53 -04:00
Kristof Provost
ab55fa11b3 netpfil tests: extend dummynet tests to pf
Now that pf can also use dummynet we should extend the existing dummynet
tests to also test it when used with pf.

Reviewed by:	donner
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31905
2021-09-24 11:41:25 +02:00
Nathaniel Wesley Filardo
0321a7990b kqueue: Add EV_KEEPUDATA flag
When this flag is set, operations that update an existing kevent will
not change the udata field.  This can be used to NOTE_TRIGGER or
EV_{EN,DIS}ABLE events without overwriting the stashed pointer.

Reviewed by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
Obtained from:	CheriBSD
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D30286
2021-09-23 17:31:39 -07:00
Konstantin Belousov
3fcbde5e88 tests/sys/fs/fusefs/read.cc: fix build on powerpc64
There sig_atomic_t is shorter than void *.
As result, it cannot keep pointer.

Assigning to void * is actually safe for us in a signal handler.

Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Fixes:	4f917847c9
Differential revision:	https://reviews.freebsd.org/D32064
2021-09-23 03:51:10 +03:00
Alan Somers
4f917847c9 fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES
During VOP_GETPAGES, fusefs needs to determine the file's length, which
could require a FUSE_GETATTR operation.  If that fails, it's better to
SIGBUS than panic.

MFC after:	1 week
Sponsored by:	Axcient
Reviewed by: 	markj, kib
Differential Revision: https://reviews.freebsd.org/D31994
2021-09-21 14:01:06 -06:00
Mark Johnston
2bd9826995 vfs: Permit unix sockets to be opened with O_PATH
As with FIFOs, a path descriptor for a unix socket cannot be used with
kevent().

In principle connectat(2) and bindat(2) could be modified to support an
AT_EMPTY_PATH-like mode which operates on the socket referenced by an
O_PATH fd referencing a unix socket.  That would eliminate the path
length limit imposed by sockaddr_un.

Update O_PATH tests.

Reviewed by:	kib
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31970
2021-09-17 14:19:06 -04:00
Mark Johnston
c13f6dd7d2 aio_test: Validate interactions between AIO on sockets and shutdown(2)
Reviewed by:	asomers, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31976
2021-09-17 14:19:06 -04:00
John Baldwin
cd16a848d1 posixshmtest: Fix various warnings raised by GCC.
- Remove unused format string arguments.

- Remove a set but unused variable.

Reviewed by:	khng, kib
Differential Revision:	https://reviews.freebsd.org/D31946
2021-09-15 09:03:18 -07:00
Alex Richardson
d7d962ead0 Add a test for https://reviews.freebsd.org/D31858 (PR 258310)
This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654)
fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed
as 98168a6e6c) and passes with the patch applied.

Reviewed By:	kib, imp
Differential Revision: https://reviews.freebsd.org/D31862
2021-09-13 10:16:05 +01:00
Mark Johnston
3a0976dea3 lio_test: Specify a mode with O_CREAT
Sponsored by:	The FreeBSD Foundation
2021-09-11 12:59:10 -04:00
Mark Johnston
141fe2dcee aio: Interlock with listen(2)
soo_aio_queue() did not handle the possibility that the provided socket
is a listening socket.  Up until recently, to fix this one would have to
acquire the socket lock first and check, since the socket buffer locks
were destroyed by listen(2).

Now that the socket buffer locks belong to the socket, simply check
SOLISTENING(so) after acquiring them, and make listen(2) return an error
if any AIO jobs are enqueued on the socket.

Add a couple of simple regression test cases.

Note that this fixes things only for the default AIO implementation;
cxgbe(4)'s TCP offload has a separate pru_aio_queue implementation which
requires its own solution.

Reported by:	syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com
Reported by:	syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com
Reported by:	syzbot+60cceb9569145a0b993b@syzkaller.appspotmail.com
Reported by:	syzbot+2d522c5db87710277ca5@syzkaller.appspotmail.com
Reviewed by:	tuexen, gallatin, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31901
2021-09-10 17:21:11 -04:00
Kristof Provost
6598cababf pf tests: synproxy to localhost test
Test syn-proxying a connection to the local host.

Sponsored by:	Modirum MDPay
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31854
2021-09-10 15:16:37 +02:00
Mark Johnston
c4c6615324 path_test: Fix test sorting
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-09-08 11:41:19 -04:00
Mark Johnston
8b83b656a5 path_test: Fix the unix socket test
The intent was to specify O_PATH to open(2).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-09-08 11:41:19 -04:00
Kristof Provost
12184311c1 netpfil tests: IPv6 dummynet queue test
Same as the v4 test, but with IPv6.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31789
2021-09-08 17:17:59 +02:00
Kristof Provost
cb6bfef9ca netpfil tests: dummynet queue test
Test prioritisation and dummynet queues.
We need to give the pipe sufficient bandwidth for dummynet to work.
Given that we can't rely on the TCP connection failing alltogether, but
we can measure the effect of dummynet by imposing a time limit on a
larger data transfer.

If TCP is prioritised it'll get most of the pipe bandwidth and easily
manage to transfer the data in 3 seconds or less. When not prioritised
this will not succeed.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31788
2021-09-08 17:17:59 +02:00
Kristof Provost
5fda5913e1 dummynet tests: pipe test for IPv6
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31787
2021-09-08 17:17:59 +02:00
Kristof Provost
d491b42535 pf tests: altq:codel_bridge requires if_bridge
Check that the bridge module is loaded before running this test.
It likely will be (as a result of running the bridge tests), but if it's
not we'll get spurious failures.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-09-01 16:13:11 +02:00
Dimitry Andric
5a3a8cb01a Silence more gtest warnings, now in fusefs tests
Follow-up d396c67f26 by also silencing warnings about deprecated
implicit copy constructors in the fusefs tests, which use googletest.

Fixes:		d396c67f26
MFC after:	3 days
2021-08-27 23:39:36 +02:00
Alan Somers
f5c6c43d4c Add a regression test for ggatec remote code execution
Tests that ggatec appropriately handles unsupported BIO operations,
rather than overflowing a buffer.

Submitted by:	Johannes Bruelltuete <johannes@jo-t.de>
PR:		213479
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D31318
2021-08-27 14:52:45 -06:00
Gleb Popov
f8b88be850 tests/sys/acl: Add ATF C test for newly added acl_* functions.
Reviewed by: kib, debdrup, gbe
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D28255
2021-08-27 11:52:21 +03:00
Kristof Provost
062463698e pf tests: Test ALTQ on top of if_bridge
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31676
2021-08-26 11:23:45 +02:00
Kristof Provost
cd46399b9c pf tests: ALTQ priority test
Test that ALTQ can prioritise one type of traffic over another. Do this
by establishing a slow link and saturating it with ICMP echos.
When prioritised TCP connections reliably go through. When not
prioritised TCP connections reliably fail.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-26 11:23:39 +02:00
Kristof Provost
e62175df4e pf tests: test ALTQ CBQ on top of if_vlan
The main purpose of this test is to verify that we can use ALTQ on top
of if_vlan, but while we're here we also exercise the CBQ code. There's
already a basis test for HFSC, so it makes sense to test another
algorithm while we test if_vlan.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31649
2021-08-25 08:57:10 +02:00
Kristof Provost
bbf832f344 pf tests: test killing states by ID
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-24 12:54:13 +02:00
Thomas Munro
3904e7966e Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD.
Add missing wrapper code to librt for these new functions so that
SIGEV_THREAD works.  Without machinery to convert it to SIGEV_THREAD_ID,
you got EINVAL.

Reviewed by:    asomers
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D31618
2021-08-22 23:49:23 +12:00
Thomas Munro
f30a1ae8d5 lio_listio(2): Allow LIO_READV and LIO_WRITEV.
Allow multiple vector IOs to be started with one system call.
aio_readv() and aio_writev() already used these opcodes under the
covers.  This commit makes them available to user space.

Being non-standard extensions, they're only visible if __BSD_VISIBLE is
defined, like the functions.

Reviewed by:    asomers, kib
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D31627
2021-08-22 23:00:42 +12:00
Samuel Robinette
0a7d1fc6f6 pf: implement set-tos for IPv6
Extend the existing set-tos keyword to also be able to set traffic class
on IPv6 traffic.
Add tests for this as well.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D31564
2021-08-19 10:07:56 +02:00
Cyril Zhang
a85404906b vmm: Add credential to cdev object
Add a credential to the cdev object in sysctl_vmm_create(), then check
that we have the correct credentials in sysctl_vmm_destroy(). This
prevents a process in one jail from opening or destroying the /dev/vmm
file corresponding to a VM in a sibling jail.

Add regression tests.

Reviewed by:	jhb, markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31156
2021-08-18 13:41:33 -04:00
Kristof Provost
e86469075c netinet tests: delete an interface with pending lookups
This has been known to trigger panics. It currently doesn't, but we may
as well have a test for it.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-17 17:01:21 +02:00
Vladimir Kondratyev
14a4d6d013 bitstring(3): Add bitstring traversal macros.
The macro bit_foreach() traverses all set bits in the bitstring in the
forward direction, assigning each location in turn to variable.

The macro bit_foreach_at() traverses all set bits in the bitstring in
the forward direction at or after the zero-based bit index, assigning
each location in turn to variable.

The bit_foreach_unset() and bit_foreach_unset_at() macros which
traverses unset bits are implemented for completeness.

Reviewed by:	asomers, dougm
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31469
2021-08-16 23:24:05 +03:00
Konstantin Belousov
b42df9dafb Add test for fstatat(pipefd, AT_EMPTY_PATH)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-14 14:41:01 +03:00
Alan Somers
825fb07c55 aio: revert the workaround for bug 251828 in the tests
This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

Do not MFC to stable/12 !

PR:		251828
Reported by:	markj
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D31535
2021-08-13 18:01:18 -06:00
Ka Ho Ng
454bc887f2 uipc_shm: Implements fspacectl(2) support
This implements fspacectl(2) support on shared memory objects. The
semantic of SPACECTL_DEALLOC is equivalent to clearing the backing
store and free the pages within the affected range. If the call
succeeds, subsequent reads on the affected range return all zero.

tests/sys/posixshm/posixshm_tests.c is expanded to include a
fspacectl(2) functional test.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kevans, kib
Differential Revision:	https://reviews.freebsd.org/D31490
2021-08-12 23:04:18 +08:00
Ka Ho Ng
0dc332bff2 Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
fspacectl(2) is a system call to provide space management support to
userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the
deallocation. vn_deallocate(9) is a public KPI for kmods' use.

The purpose of proposing a new system call, a KPI and a VOP call is to
allow bhyve or other hypervisor monitors to emulate the behavior of SCSI
UNMAP/NVMe DEALLOCATE on a plain file.

fspacectl(2) comprises of cmd and flags parameters to specify the
space management operation to be performed. Currently cmd has to be
SPACECTL_DEALLOC, and flags has to be 0.

fo_fspacectl is added to fileops.
VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation
of VOP_DEALLOCATE(9) is provided.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D28347
2021-08-05 23:20:42 +08:00
Alex Richardson
c826e08841 Fix MK_TESTS build with MK_ASAN/MK_UBSAN
Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D31049
2021-08-02 14:33:24 +01:00
Kristof Provost
441d15a482 bridge tests: verify that we can't change MTU of bridge member interfaces
Reviewed by:	donner
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31305
2021-07-28 22:03:38 +02:00
Kristof Provost
6e43950640 bridge tests: test changing the bridge MTU
Changing the bridge MTU will now also change all of the member interface
MTUs. Test this.

Reviewed by:	donner
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31289
2021-07-28 22:01:12 +02:00
Kristof Provost
4e860bd5da pf tests: make killstate:match more robust
Only lists the states relevant to the connection we're killing.
Sometimes there are IPv6 related states (due to the usual IPv6
background traffic of router solicitations, DAD, ...) that causes us to
think we failed to kill the state, which in turn caused the test to fail
intermittently.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-27 15:32:48 +02:00
Kristof Provost
3e87f800f0 net tests: basic test case for bpf(4)'s ability to set vlan pcp
Use dhclient with its 'vlan-pcp' option to set a VLAN PCP value and
verify that it actually gets set.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31276
2021-07-26 23:13:31 +02:00
Kristof Provost
4b765ab4cd bridge tests: test linking bridges with a gif tunnel
Fairly basic test case for using gif(4)'s ability to tunnel Ethernet
traffic between bridges.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-26 23:13:31 +02:00
Eric van Gyzen
9666cda976 aio_md_test: label the md
Add a label to md devices created by this test.  The next time this
test leaks md devices, finding the culprit will be much easier.

Thanks to:	sobomax, for adding labels in r322969
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-07-23 09:19:29 -05:00
Eric van Gyzen
ea0e1b19f2 aio_md_test: NUL-terminate result of readlink
readlink does not NUL-terminate the output buffer.  This led to spurious
failures to destroy the md device because the unit number was garbage.
NUL-terminate the output buffer.

Reported by:	ASLR
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-07-23 09:19:29 -05:00
Eric van Gyzen
c6f92e64b6 aio_md_test: fix cleanup
ATF cleanup functions cannot use functions such as ATF_REQUIRE
and atf_tc_fail.  These functions assert that a test case is
currently running, which is not true during cleanup, so the
process aborts.  Change the cleanup function to simply print
to stderr and return.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-07-23 09:19:28 -05:00
Cy Schubert
2f6c3ea960 Import wpa_supplicant/hostapd commit b4f7506ff 2021-07-21 14:14:05 -07:00
Kristof Provost
27ab791a55 pf tests: ensure syncookie does not create state
Test that with syncookies enabled pf does not create state for
connections before the remote peer has replied to the SYN|ACK message.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31142
2021-07-20 10:36:14 +02:00
Kristof Provost
3be9301a7e pf tests: Forwarding syncookie test
Test syncookies on a forwarding host. That is, in a setup where the
machine (or vnet) running pf is not the same as the machine (or vnet)
running the server it's protecting.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D31141
2021-07-20 10:36:14 +02:00
Kristof Provost
f808bb9b7e pf tests: test locally originated connections with route-to
PR:		257106
Submitted by:	Mark Cammidge <mark@peralex.com>
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D31178
2021-07-17 14:28:08 +02:00
Kristof Provost
d363ebc78c pf tests: Test the match keyword
The new match keyword can currently only assign queues, so we can only
test it with ALTQ.
Set up a basic scenario where we use 'match' to assign ICMP traffic to a
slow queue, and confirm that it's really getting slowed down.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31116
2021-07-17 12:01:08 +02:00
Mark Johnston
2e5f615295 lio_listio: Don't post a completion notification if none was requested
One is allowed to use LIO_NOWAIT without specifying a sigevent.  In this
case, lj->lioj_signal is left uninitialized, but several code paths
examine liov_signal.sigev_notify to figure out which notification to
post.  Unconditionally initialize that field to SIGEV_NONE.

Add a dumb test case which triggers the bug.

Reported by:	KMSAN+syzkaller
Reviewed by:	asomers
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31197
2021-07-15 22:41:10 -04:00
Ed Maste
c9144ec14d Skip netgraph tests when WITHOUT_NETGRAPH is set
PR:		256986
Reported by:	John Marshall
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-07-06 09:45:34 -04:00
Lutz Donnerhacke
b3dc6f137b tests/libalias: Bugfix in used variables
Fix two copy and waste errors (referencing the wrong variable).

MFC after:	3 days
2021-07-03 00:31:54 +02:00
Kristof Provost
d8d43b2de1 pf tests: Stress state retrieval
Create and retrieve 20.000 states. There have been issues with nvlists
causing very slow state retrieval. We don't impose a specific limit on
the time required to retrieve the states, but do log it. In excessive
cases the Kyua timeout will fail this test.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30943
2021-07-02 14:46:32 +02:00