aboutsummaryrefslogtreecommitdiff
path: root/tests/sys
Commit message (Collapse)AuthorAgeFilesLines
...
* fusefs: add a regression test for a cluster_read bugAlan Somers2025-10-231-0/+87
| | | | | | | | | | | | | | | VOP_BMAP is purely advisory. If VOP_BMAP returns an error during readahead, cluster_read should still succeed, because the actual data was still read just fine. Add a regression test for PR 264196, wherein cluster_read would fail if VOP_BMAP did. PR: 264196 MFC with: 62aef3f73f38db9fb68bffc12cc8900fecd58f0e Reported by: danfe Reviewed by: arrowd Differential Revision: https://reviews.freebsd.org/D51316
* so_reuseport_lb_test: Add a test case for connected UDP socketsMark Johnston2025-10-221-0/+148
| | | | Approved by: so
* tests/sys/netpfil/pf/sctp: make use of required.kmodsAlan Somers2025-10-211-7/+11
| | | | | | | | | This greatly speeds up skipping a test that can't be run. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D53215
* pf: fix 'no rdr'Kristof Provost2025-10-191-0/+51
| | | | | | | | | | | | | Ensure we always have a non-NULL rule pointer (ctx.rm). It might have gotten set to NULL by pf_get_translation(). While here also restore the previous rdr behaviour be re-adding the incorrectly removed 'break' in pf_match_translation_rule. PR: 290177 MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D53191
* glabel: add a basic testBrad Davis2025-10-173-0/+67
| | | | | | | Reviewed by: asomers MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D53178
* tests/carp: kill routed(8) before destroying interfacesGleb Smirnoff2025-10-151-0/+3
| | | | | | | | Otherwise routed logs a warning: "MCAST_LEAVE_GROUP ALLROUTERS: Can't assign requested address" that may be misinterpreted as a problem.
* netinet: do route lookup when asked to join multicast group on ifindex 0Gleb Smirnoff2025-10-152-6/+57
| | | | | | | | | | | The code to do the route lookup was already there, but was used only for the legacy IP_ADD_MEMBERSHIP when called without index. Do same lookup for IP_ADD_MEMBERSHIP with index and what is more important for MCAST_JOIN_GROUP, if the supplied index is 0. This is a neat feature and Linux does that, so this should make a few applications easier portable to FreeBSD. Differential Revision: https://reviews.freebsd.org/D52918
* unix/stream: repair SO_SNDTIMEOGleb Smirnoff2025-10-151-0/+27
| | | | | | | | | | The send operations are waiting on the peer's socket buffer, but we shall use our timeout value. Provide a test for that. Reported by: phk Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D53081 Fixes: d15792780760ef94647af9b377b5f0a80e1826bc
* tests/multicast: fix test flakynessGleb Smirnoff2025-10-141-13/+16
| | | | | | | | The receiver is run as a background job, so we need a wait loop to make sure it has been fully functional before launching sender. Reported by: Siva Mahadevan <me svmhdvn.name> PR: 290210
* fusefs: fix intermittency in the BadServer.ShortWrite testAlan Somers2025-10-141-0/+5
| | | | | | | | | | | | | | | This test implicitly depended on the order in which two threads completed. If the test thread finished first, the test would pass. But if the mock file system thread did, it would attempt to read from an unmounted file system, and fail. As a result, the test would randomly fail once out of every several thousand executions. Fix it by telling the mock file system's event loop to exit without attempting to read any more events. Reported by: Siva Mahadevan <me@svmhdvn.name> MFC after: 1 week Reviewed by: Siva Mahadevan <me@svmhdvn.name> Differential Revision: https://reviews.freebsd.org/D53080
* tcp: Initial ktest for HPTSNick Banks2025-10-132-0/+5
| | | | | | Reviewed by: rrs, tuexen Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D52979
* mmap_test: determine page size at run time rather than compile timeChuck Silvers2025-10-131-15/+16
| | | | | | Sponsored by: Netflix Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D52735
* pf tests: verify checksum offload handlingKristof Provost2025-10-111-0/+3
| | | | | | | | | | | | Disable epair's checksum offload on one interface in a nat test, to ensure that pf does the right thing in scenarios where one interface offloads checksum handling and one does not. We trust the TCP (or ICMP) checksum verification code to drop the packet if pf does it wrong, which will cause the test case to fail. Suggested by: tuexen Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: add missing atf_test_case lines for nat testsKristof Provost2025-10-111-0/+4
| | | | | | | | | The lack of these lines means we don't call the cleanup function. That's not as bad as it could be, because these tests are nested in a jail by Kyua, so most of the cleanup work (destroying jails and interfaces) is done when the parent jail goes away, but it's still better to have these lines. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: give rules_counter:4G more timeKristof Provost2025-10-111-0/+1
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: give inetd some time to startKristof Provost2025-10-111-0/+3
| | | | | | | Give inetd time to start rather than immediately trying to connect to it. Make the tests a little more robust. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: make syncookie:loopback more robustKristof Provost2025-10-111-0/+3
| | | | | | | Give the background nc process a bit of time to start before we attempt to connect to it. Sponsored by: Rubicon Communications, LLC ("Netgate")
* tests/mac_ipacl: restore sysctls after modificationSiva Mahadevan2025-10-083-8/+17
| | | | | | | | | | | | While here, use 'required_kmods' instead of ad-hoc checks. Signed-off-by: Siva Mahadevan <me@svmhdvn.name> Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull request: https://github.com/freebsd/freebsd-src/pull/1856
* tests/mac_portacl: restore sysctls after modificationSiva Mahadevan2025-10-084-10/+5
| | | | | | | | | | | | While here, use 'required_kmods' instead of ad-hoc checks. Signed-off-by: Siva Mahadevan <me@svmhdvn.name> Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull Request: https://github.com/freebsd/freebsd-src/pull/1855
* tests/aio: Add support for larger max_buf_aio to vectored_big_iovcnt testOlivier Cochard2025-10-071-5/+7
| | | | | | | | | | | | | | Fix a test failure that occurs when max_buf_aio exceeds 31, as the calculated buffer size exceeds the 16 KB memory disk device. Increase the MD device size to 1 MB to prevent truncation. Rename MD_LEN to DEVICE_IO_LEN for clarity and add a more descriptive error message. Reviewed by: asomers Approved by: asomers Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D52914
* tests/netinet: fix so_reuseport_lb_test flakynessGleb Smirnoff2025-10-071-0/+5
| | | | | | | | | Stop the threads before exiting test body. Otherwise there is a chance threads would use the softc that is stored on the main thread stack after it is destroyed and the test would fail. Stop the threads in the reverse order, so that listener is stopped after all connectors are stopped. Tested by: olivier
* tarfs: Simplify sameness checksDag-Erling Smørgrav2025-10-071-3/+3
| | | | | | Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D52928
* filedesc: Close race between fcntl(F_SETFL) and ioctl(FIONBIO/FIOASYNC)John Baldwin2025-10-031-0/+27
| | | | | | | | | | | | | | | | | - Use the recently-added fsetfl_lock/unlock API to synchronize direct FIONBIO and FIOASYNC ioctls with fcntl(F_SETFL). - While here, skip calling the underlying ioctl if the flag's current state matches the requested state. - Also while here, only update the flag state if the underlying ioctl succeeds. This fixes a bug where the flags represented the new state even if the underlying ioctl failed. A test is added for this last case that a failing FIOASYNC on /dev/null doesn't result in setting O_ASYNC in the file flags. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D52721
* fcntlflags_test: Port to atf-c(3)John Baldwin2025-10-032-60/+58
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D52720
* pf: fix 'natpass'Kristof Provost2025-10-022-1/+59
| | | | | | | | | | | | If an rdr (or nat) rule specifies 'pass' we don't run the filter rules, we just pass the traffic. Or at least, we did until that got unintentionally broken. Restore that behaviour and add a test case. While here also fix nat:dummynet_mask, which relied on the broken behaviour. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D52838
* bitstring_test: fix bit_nclear/bit_nset tests for last iterationRyan Libby2025-10-021-8/+6
| | | | | | | | Also convert nearby ATF_REQUIRE_MSG to ATF_REQUIRE_INTEQ_MSG. Reported by: GCC -Wint-in-bool-context Reviewed by: asomers, des Differential Revision: https://reviews.freebsd.org/D45893
* netinet6 tests: accept an RA on an interface without /64 addressKristof Provost2025-10-021-0/+39
| | | | | | | Excercise the code introduced in 9e792f7ef729 ("sys/netinet6: Fix SLAAC for interfaces with no /64 LL address"). Sponsored by: Rubicon Communications, LLC ("Netgate")
* tests/netinet: add a few missing atf_checks in multicast.shGleb Smirnoff2025-10-021-0/+2
| | | | Fixes: d0c8a0b3e6fc5372428eb4fddcd4f8c65b5b0ee0
* tests/netinet: extend IPv4 multicast testing frameworkGleb Smirnoff2025-10-013-18/+239
| | | | | | | | | | | | | Provide a helper program multicast-receive.c that joins arbitrary group on arbitrary specified interface and receives a single datagram and prints it out. In multicast.sh provide a template with two jails connected by two interface pairs, so that we can check sends/receives in presence of multiple interfaces. Compose a few basic tests to check legacy and new IP_ADD_MEMBERSHIP and MCAST_JOIN_GROUP.
* tests/netinet: rename and extend sendto-IP_MULTICAST_IF.cGleb Smirnoff2025-10-013-16/+51
| | | | | | Rename this test helper app to multicast-send.c. Extend it to send from/to arbitrary addresses and arbitrary payload so that it can be used in more test scenarios.
* pf tests: fix intermittent mld test failuresKristof Provost2025-09-302-21/+16
| | | | | | | | | | | We can't reliably check for the absence of replies to our MLD queries (because a host may announce its multicast subscriptions), so enable pf logging and check for the relevant error message instead. PR: 289821 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D52762
* pf: Fix interface counters for af-to rulesKajetan Staszkiewicz2025-09-281-2/+16
| | | | | | | | | | | | | An inbound af-to rule creates a state bypassing outbound pf_test(). In such case increase counters of the outbound interface directly in pf_route() for post-af-to address family. For outbound af-to rules ensure that post-af-to address family is used to increase interface counters. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D52448
* pf: Fix rule and state countersKajetan Staszkiewicz2025-09-284-9/+838
| | | | | | | | | | | | | | | | | | | | | | | | | | Increasing counters on "match" rules causes the 1st packet making a connection to be double-counted, but only for rule counters, not rules' tables, because those are not increased at all during rule parsing. Remove "match" rule counter handling during rule parsing, do it only in pf_counters_inc(). NAT can be performed either by "nat" rules in the NAT ruleset or by "match" rules. Rules before the NAT rule, and the NAT rule itself match on pre-NAT addresses, and later rules match on post-NAT addresses. When increasing counters go over rules in the same order as a packet would and use source and destination addresses for updating table counters from appropriate state key, taking into consideration on which rule NAT happens. Use AF from state key, so that table counters can be properly updated for af-to rules. Synchronize match rule updating behaviour to that of OpenBSD: if rules match, but state is not created, don't update counters. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D52447
* pf: Always skip outbound filtering for inbound af-to rulesKajetan Staszkiewicz2025-09-281-5/+7
| | | | | | | | | | | | | | | The af-to rules on inbound direction create a single state spanning both the inbound and the outbound interface. Calling pf_test() for the outbound direction in pf_route() makes the packet pass through state search, match the existing state, never evaluate the ruleset, and increase state counters. Check that the state comes from an af-to rule in inbound direction, and if yes, skip outbound testing. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D52446
* tests/netlink: fix flaky netlink_sockets:sizesGleb Smirnoff2025-09-281-2/+16
| | | | | | | | | The problem is that fullsocket() creates a socket that has both send and receive buffers full and as we process messages from the receive buffer we allow the kernel to continue processing of the send buffer and a new message may arrive while the test expects that no new messages arrive. Fix that by creating a socket that has several messages in the receive buffer, but don't have any in the send buffer.
* pf tests: test once rule inside an anchorKristof Provost2025-09-251-0/+49
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: basic 'once' testKristof Provost2025-09-252-0/+84
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: pass pre-NAT addresses to dummynetKristof Provost2025-09-241-0/+45
| | | | | | | | | | | | | When we're NAT-ing give dummynet (via its struct ip_fw_args) the pre-NAT source and destination addresses. That's what we used to do, but that got unintentionally changed during the nat64 work. The pre-NAT addresses make somewhat more sense, in that it enables limiting based on specific LAN clients. See also: https://redmine.pfsense.org/issues/15770 Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: Add pfsync protocol for FreeBSD 15Kajetan Staszkiewicz2025-09-231-7/+459
| | | | | | | | | | | | A new version of pfsync packet is introduced: 1500. This version solves the issues with data alignment introduced in version 1400 and adds syncing of information needed to sync states created by rules with af-to (original interface, af and proto separate for wire and stack keys), of rt_af needed for prefer-ipv6-nexthop, and of tag names. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D52176
* pf: Fix interface binding for af-to with route-toKajetan Staszkiewicz2025-09-232-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | States created by inbound af-to rules bypass outbound filtering and span both the inbound and outbound interfaces. When the first packet for such rule creates a state, this state has st->orig_kif set the original inbound interface and kif set to V_pfi_all. When the outbound interface is eventually known st->kif is updated to that interface. When not using route-to, the outbound route and its interface are determined for the new address family and st->kif is set to that interface. However when using route-to, ifp is explicitely given and the code for updating st->kif is not run for the first packet. When the returning packet matches the state, the code is run but updates st->kif to the original inbound interface, which is now the outbound interface. The state ends up with st->kif == st->orig_kif and won't forward any more returning packets. There is another block of code performing such update, but only for reply-to. Perform the update of st->kif in a single place no matter if ifp was explicitely given or found by routing lookup. For checks using pings check if really all pings have been replied to, because a single reply is enough to have ping exit with a successful exit code. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D52445
* fusefs: fix a kernel panic regarding SCM_RIGHTSAlan Somers2025-09-192-0/+127
| | | | | | | | | | | | | | | | | | If the last copy of an open file resides within the socket buffer of a unix-domain socket, then VOP_CLOSE will be called with no thread information. Fix fusefs to handle that case, and add a regression test. Also add a test case for writes to a file that lies within a sockbuf. Along with close, a write from the writeback cache is the only other operation I can think of that might apply to a file residing in a sockbuf. PR: 289686 Reported by: iron.udjin@gmail.com MFC after: 1 week Sponsored by: ConnectWise Reviewed by: glebius, markj Differential Revision: https://reviews.freebsd.org/D52625
* pf tests: test set limitKristof Provost2025-09-171-0/+35
| | | | | | Verify that 'set limit anchors' now has the expected effect. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: declare a table inside an anchorKristof Provost2025-09-171-0/+38
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: Add python3 as a dependencyJose Luis Duran2025-09-171-0/+15
| | | | | | | | | | These tests use pft_ping.py, which requires python3 and Scapy. Reviewed by: ngie Approved by: emaste (mentor) Fixes: 65c318630123 ("pf: Add prefer-ipv6-nexthop option for route-to pools") MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D52589
* pf tests: verify rule numbers in pflog outputKristof Provost2025-09-151-0/+59
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: test fragment countersKristof Provost2025-09-151-0/+67
| | | | | | Ensure that the fragmentation counters work as expected. Sponsored by: Rubicon Communications, LLC ("Netgate")
* fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 testAlan Somers2025-09-151-2/+10
| | | | | | | | | | | | | The LastLocalModify tests were originally written to simulate a race condition between VOP_SETATTR and VOP_LOOKUP. They were later extended to cover some other VOPs that can affect file size, including VOP_WRITE. However, the test never correctly simulated the race with VOP_WRITE. So that test only ever passed by accident. Fix it by always opening the file with O_DIRECT. PR: 289237 Reported by: Siva Mahadevan <me@svmhdvn.name> MFC after: 1 week
* pf tests: test state killing by source and destination addressKristof Provost2025-09-101-0/+63
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf tests: recusrive table printing testKristof Provost2025-09-101-0/+38
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: fix possible pd->pcksum NULL derefKristof Provost2025-09-052-0/+77
| | | | | | | | | | Ensure that we always populate pcksum, not just for TCP/UDP/SCTP/ICMP. We may end up using it (through pf_change_ap()) if we're doing NAT, so ensure it's available even if it's sometimes just a dummy variable. Reported-by: syzbot+3e73a7cba8cb6cd46f90@syzkaller.appspotmail.com MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate")