Commit graph

1150 commits

Author SHA1 Message Date
Kristof Provost
60c9798db7 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

(cherry picked from commit 3e87f800f0)
2021-08-02 16:50:32 +02:00
Kristof Provost
096cacc811 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")

(cherry picked from commit 4b765ab4cd)
2021-08-02 16:50:32 +02:00
Kristof Provost
c1bb4edaa0 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

(cherry picked from commit d363ebc78c)
2021-07-31 10:12:02 +02:00
Kristof Provost
2400173b93 altq tests: Basic ALTQ test
Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect.

Reviewed by:		donner@
Differential Revision:	https://reviews.freebsd.org/D28303

(cherry picked from commit 16b3833344)
2021-07-31 10:12:02 +02:00
Kristof Provost
efe3bf0fb0 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")

(cherry picked from commit 4e860bd5da)
2021-07-30 09:51:04 +02:00
Mark Johnston
9ac0aec3a3 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
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e5f615295)
2021-07-29 20:32:58 -04:00
Alan Somers
c7fe00ae40 fusefs: correctly set lock owner during FUSE_SETLK
During FUSE_SETLK, the owner field should uniquely identify the calling
process.  The fusefs module now sets it to the process's pid.
Previously, it expected the calling process to set it directly, which
was wrong.

libfuse also apparently expects the owner field to be set during
FUSE_GETLK, though I'm not sure why.

PR:		256005
Reported by:	Agata <chogata@moosefs.pro>
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D30622

(cherry picked from commit 18b19f8c6e)
2021-07-27 11:44:28 -06:00
Kristof Provost
4aa52f90f7 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

(cherry picked from commit 27ab791a55)
2021-07-27 09:44:06 +02:00
Kristof Provost
1156a429eb 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

(cherry picked from commit 3be9301a7e)
2021-07-27 09:43:58 +02:00
Ed Maste
ae2e05423d Skip netgraph tests when WITHOUT_NETGRAPH is set
PR:		256986
Reported by:	John Marshall
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c9144ec14d)
2021-07-12 20:27:19 -04:00
Kristof Provost
1f4a640396 netpfil tests: Basic dummynet pipe test
Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put
in the common tests because we hope to add dummynet support to pf in the
near future.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30380

(cherry picked from commit ea3eca5cb6)
2021-07-09 10:09:34 +02:00
Kristof Provost
36c08263b7 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

(cherry picked from commit d8d43b2de1)
2021-07-09 10:07:10 +02:00
Kristof Provost
f6d448caf6 pf tests: ftp-proxy test
Basic test case for ftp-proxy

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

(cherry picked from commit dd82fd3543)
2021-07-08 08:47:09 +02:00
Lutz Donnerhacke
dc42a0503b tests/libalias: Bugfix in used variables
Fix two copy and waste errors (referencing the wrong variable).

(cherry picked from commit b3dc6f137b)
2021-07-05 07:58:02 +02:00
Alan Somers
27d5544166 fusefs: ensure that FUSE ops' headers' unique values are actually unique
Every FUSE operation has a unique value in its header.  As the name
implies, these values are supposed to be unique among all outstanding
operations.  And since FUSE_INTERRUPT is asynchronous and racy, it is
desirable that the unique values be unique among all operations that are
"close in time".

Ensure that they are actually unique by incrementing them whenever we
reuse a fuse_dispatcher object, for example during fsync, write, and
listextattr.

PR:		244686
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D30810

(cherry picked from commit 5403f2c163)
2021-07-03 18:05:13 -06:00
Alan Somers
fd9bab551b fusefs: also debug INIT operations in the test suite
Reviewed by:	pfg

(cherry picked from commit 77b040c993)
2021-07-03 18:03:54 -06:00
Alan Somers
7b096a997f fusefs: support EVFILT_WRITE on /dev/fuse
/dev/fuse is always ready for writing, so it's kind of dumb to poll it.
But some applications do it anyway.  Better to return ready than EINVAL.

Reviewed by:	emaste, pfg
Differential Revision: https://reviews.freebsd.org/D30784

(cherry picked from commit 7b8622fa22)

Simplify fuse_device_filt_write

It always returns 1, so why bother having a variable.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/478

(cherry picked from commit 9b876fbd50)
2021-07-03 17:57:51 -06:00
Ryan Libby
16d43e5602 shared shadow vm object invalidation regression test
Add a regression test for a scenario where a shadow vm object is shared
by multiple mappings.  If a page COW occurs through one of the mappings,
then the virtual-to-physical mapping may become invalidated.

This tests the scenario from CVE-2021-29626 which was fixed by
982693bb72.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon

(cherry picked from commit 13d4f96130)
2021-07-02 14:14:32 -07:00
Alan Somers
b6de677b70 fusefs: reenable the WriteCluster.cluster_write_err test
The underlying panic was just fixed by
revision 27006229f7

PR:		238565
MFC with:	27006229f7

(cherry picked from commit 425bbe9e64)
2021-06-17 14:09:15 -06:00
Alan Somers
ee3a7246c6 gmultipath: make physpath distinct from the underlying providers'
zfsd uses a device's physical path attribute to automatically replace a
missing ZFS disk when a blank disk is inserted into the same physical
slot.  Currently gmultipath passes through its underlying providers'
physical path attribute.  That may cause zfsd to replace a missing
gmultipath provider with a newly arrived, single-path disk.  That would
be bad.

This commit fixes that problem by simply appending "/mp" to the
underlying providers' physical path, in a manner similar to what geli
already does.

Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D29941

(cherry picked from commit 420dbe763f)
2021-06-17 12:39:14 -06:00
Lutz Donnerhacke
053937ce6e tests/netgraph: Tests for ng_vlan_rotate
Test functionality of ng_vlan_rotate(4):
 - Rotate 1 to 9 stagged vlans in any possible direction and length
 - Rotate random combinations of ethertypes (8100, 88a8, 9100)
 - Automatic reverse rotating for backward data flow
 - Test too many and too few vlans

Reviewed by:	kp (earlier version)
Differential Revision: https://reviews.freebsd.org/D30670

(cherry picked from commit 6b08e68be1)
2021-06-16 13:25:04 +02:00
Lutz Donnerhacke
7d243608d5 tests/netgraph: Tests for ng_hub
Test functionality of ng_hub(4):
 - replicting traffic to anything but the sending hook
 - persistence
 - an unrestricted loop
 - implementation limits with many hooks.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D30633

(cherry picked from commit 7863faa78a)
2021-06-16 13:25:01 +02:00
Lutz Donnerhacke
1b379f5858 tests/netgraph: Tests for ng_bridge
Test functionality of ng_bridge(4):
 - replicating traffic to anything but the sending hook
 - persistence
 - detect loops
 - unicast to only one link of many
 - stretch to implementation limits on broadcast

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D30647
Differential Revision: https://reviews.freebsd.org/D30699

(cherry picked from commit 6181470239)
(cherry picked from commit 5554abd9cc)
2021-06-15 14:38:49 +02:00
Lutz Donnerhacke
36c7408818 tests/netgraph: Inital framework for testing libnetgraph
Provide a framework of functions to test various netgraph modules.
Tests contain:
 - creating, renaming, and destroying nodes
 - connecting and removing hooks
 - sending and receiving data
 - sending ASCII messages and receiving binary responses
 - errors can be passed for indiviual inspection or fail the test

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D30629
Differential Revision: https://reviews.freebsd.org/D30657
Differential Revision: https://reviews.freebsd.org/D30671
Differential Revision: https://reviews.freebsd.org/D30699

(cherry picked from commit 24ea1dbf25)
(cherry picked from commit 09307dbfb8)
(cherry picked from commit 9021c46603)
(cherry picked from commit 5554abd9cc)

Also contains some fixups:
 - indent all files correctly
 - finish factoring out
 - remove debugging code
 - check for renaming issues reported in PR241954

PR:	241954
Differential Revision: https://reviews.freebsd.org/D30692
Differential Revision: https://reviews.freebsd.org/D30714
Differential Revision: https://reviews.freebsd.org/D30713

(cherry picked from commit a664ade939)
(cherry picked from commit 0afa9be039)
(cherry picked from commit 43e4821315)
2021-06-15 14:31:32 +02:00
Kristof Provost
dedd9ee84b pf tests: Make killstate:match more robust
The killstate:match test starts nc as a background process. There was no
guarantee that the nc process would have connected by the time we check
for states, so this test occasionally failed without good reason.

Teach the test to wait for at least some states to turn up before
executing the critical checks.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 70dd30d49c)
2021-06-07 17:42:19 +02:00
Kristof Provost
80fe5ac555 pf tests: Only log critical errors from scapy
See a26e895f3d. Silence these new tests as
well.

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

(cherry picked from commit 9d0bc96ef8)
2021-06-02 20:50:56 +02:00
Kristof Provost
b4612f6a27 pf tests: Test cases for fragment reassembly
Obtained from:	Alexander Bluhm, OpenBSD

(cherry picked from commit d39d5ee2d6)
2021-06-02 20:50:56 +02:00
Lutz Donnerhacke
488f39f355 tests/libalias: Test LibAliasIn and redirection
Rework the tests to check the correct layer in a single test. Factor
out tests for reuse in other modules. Extend the test suite for
libalias(3) to incoming connections. Test the various types of
redirections.

gettimeofday(3) is almost as expensive as the calls to libalias.
So the call frequency for this call is reduced by a factor of 1000 in
order to neglect it's influence.

Using NAT entries became more realistic: A communication of a random
length of up to 150 packets (10% outgoing, 90% incoming) is applied
for each entry.

Add port forwardings to the performance tests.  This will cause random
incoming packets to match the random port forwardings opends beforehand.

After a long test run, a lot of ressouces have been allocated.
Measure the time tot free them.

Reviewed by:	kp (partially)
Differential Revision: https://reviews.freebsd.org/D30412
Differential Revision: https://reviews.freebsd.org/D30408
Differential Revision: https://reviews.freebsd.org/D30405
Differential Revision: https://reviews.freebsd.org/D30443

(cherry picked from commit f1462ab051)
(cherry picked from commit 755bab6d55)
(cherry picked from commit 6e87898a2c)
(cherry picked from commit d62e1ecba0)
(cherry picked from commit 5434ebd256)

Fix various bugs:
(cherry picked from commit ccac04cae5)
(cherry picked from commit 7b8696bf12)
(cherry picked from commit fef99da69f)
(cherry picked from commit f4c460dacd)
2021-06-02 11:35:09 +02:00
Lutz Donnerhacke
43acee0cdd tests/libalias: Reduce stress
Due to the new, external performance test utility, the regular test
suite can reduce the stress test to a fair amount of activity.

(cherry picked from commit a660948b7b)
2021-05-30 16:00:54 +02:00
Lutz Donnerhacke
cfeeb57166 test/libalias: Tests for instantiation and outgoing NAT
In order to modify libalias for performance, the existing
functionality must not change.  Enforce this.

Testing LibAliasOut functionality. This concentrates the typical use
case of initiating data transfers from the inside.  Provide a
exhaustive test for the data structure in order to check for
performance improvements.

In order to compare upcoming changes for their effectivness, measure
performance by counting opertions and the runtime of each operation
over the time.  Accumulate all tests in a single instance, so make it
complicated over the time.  If you wait long enough, you will notice
the expiry of old flows.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D30307
Differential Revision: https://reviews.freebsd.org/D30335
Differential Revision: https://reviews.freebsd.org/D30379

(cherry picked from commit 7fd8baee75)
(cherry picked from commit c1fbb54f4b)
(cherry picked from commit 33c1bdfc3e)
2021-05-29 15:09:55 +02:00
Kristof Provost
3c790f9e1d pf tests: Test the ability to kill floating states by interface
Reviewed by:	eri
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30247

(cherry picked from commit 7bd7933f9a)
2021-05-27 09:09:40 +02:00
Kristof Provost
25fa4b8e66 pf tests: More set skip on <ifgroup> tests
Test the specific case reported in PR 255852. Clearing the skip flag
on groups was broken because pfctl couldn't work out if a kif was a
group or not, because the kernel no longer set the pfik_group pointer.

PR:		255852
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30285

(cherry picked from commit 45db385545)
2021-05-24 17:38:22 +02:00
Kristof Provost
2b8399210b tests: Only log critical errors from scapy
Since 2.4.5 scapy started issuing warnings about a few different
configurations during our tests. These are harmless, but they generate
stderr output, which upsets atf_check.

Configure scapy to only log critical errors (and thus not warnings) to
fix these tests.

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

(cherry picked from commit a26e895f3d)
2021-05-18 12:00:38 +02:00
Kristof Provost
ad27abda39 bridge tests: Test STP config BPDU validation
PR:		254924
Reviewed by:	donner
Differential Revision:	https://reviews.freebsd.org/D29783

(cherry picked from commit 4ae3a97e12)
2021-05-18 12:00:38 +02:00
Kristof Provost
38ad0faf97 netinet6 tests: Fix Python warning
Python 3.8 warns about line 112:
    'SyntaxWarning: "is" with a literal. Did you mean "=="?'

Use '==' as Python suggests.

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

(cherry picked from commit 80430c15ca)
2021-05-18 12:00:38 +02:00
Kristof Provost
97f7dda014 pf tests: Test killing matching states
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30093

(cherry picked from commit ac200a9c38)
2021-05-14 10:48:48 +02:00
Kristof Provost
2a00e1cde4 pf tests: Test killing states by gateway
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30059

(cherry picked from commit c2e11d81d2)
2021-05-14 10:39:39 +02:00
Kristof Provost
5c371d922a pf tests: Test set keepcounters
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29781

(cherry picked from commit e14d56f370)
2021-05-11 17:04:45 +02:00
Kurosawa Takahiro
e49799dcf1 pf: Implement the NAT source port selection of MAP-E Customer Edge
MAP-E (RFC 7597) requires special care for selecting source ports
in NAT operation on the Customer Edge because a part of bits of the port
numbers are used by the Border Relay to distinguish another side of the
IPv4-over-IPv6 tunnel.

PR:		254577
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D29468

(cherry picked from commit 2aa21096c7)
2021-05-11 17:04:45 +02:00
Mark Johnston
65a160cd0b path_test: Add a few new test cases
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b59851e99c)
2021-05-10 20:28:44 -04:00
Kristof Provost
ac81c2a641 pf tests: Test killing states with multiple labels
Now that we support having multiple labels on a rule ensure that we can
use each rule label to kill states.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29938

(cherry picked from commit 5632f58535)
2021-05-10 21:45:57 +02:00
Kristof Provost
a599304a6c pf tests: Test automatically generated tables
Add a test case where the pfctl optimizer will generate a table
automatically. These tables have long names, which we accidentally broke
in the nvlist ADDRULE ioctl.

Reviewed by:	melifaro
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29989

(cherry picked from commit 08d7730821)
2021-05-10 21:45:57 +02:00
Kristof Provost
3f9591da18 pf tests: Test scrub fragment reassemble on interfaces with different MTU
There's a problem with pf's reassembly code where it produces incorrect
checksums when reassembling across interfaces with different MTUs.
Test this.

PR:		255432
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30013

(cherry picked from commit 388c0cde10)
2021-05-07 10:16:23 +02:00
Kristof Provost
07baf5f27e pf tests: Test clearing rules counters
This was briefly broken, so ensure that we can read and clear rules
counters.

MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29728

(cherry picked from commit 112f007e12)
2021-05-07 10:15:43 +02:00
Kristof Provost
d6d039ea74 pf tests: Test using '<ifgroup>:network' in tables
MFC after:	1 week

(cherry picked from commit daa5350d0e)
2021-05-04 09:51:25 +02:00
Mark Johnston
b0ad62ff6f Add some regression tests for O_PATH and AT_EMPTY_PATH
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29719

(cherry picked from commit 3a248c8441)
2021-04-29 10:22:43 -04:00
Kristof Provost
ce5da7d243 pf tests: IPv6 test case for the 'kill state(s)' feature
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29797

(cherry picked from commit 9af2317423)
2021-04-28 17:06:28 +02:00
Kristof Provost
faa873d0f9 pf tests: Test cases for the 'kill state(s)' feature
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29796

(cherry picked from commit 065b5c7fb2)
2021-04-28 17:06:28 +02:00
Alexander V. Chernikov
fe04896da3 Improve debugging output on routing tests failure.
Most of the routing tests create per-test VNET, making
 it harder to repeat the failure with CLI tools.
Provide an additional route/nexthop data on failure.

Differential Revision: https://reviews.freebsd.org/D29957
Reviewed by:	kp
MFC after:	2 weeks

(cherry picked from commit bddae5c8a6)
2021-04-26 08:49:14 +00:00
Alexander V. Chernikov
98ea411989 Fix typo in rtsock_common.h
MFC after:	3 days

(cherry picked from commit 37c0f4a207)
2021-04-26 08:48:35 +00:00