aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add some simple regression tests for ip_mrouteMark Johnston6 days4-4/+629
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These use atf_python to create a number of hosts linked to a router. The router runs pimd (for IPv4) or ip6_mrouter (simplistic IPv6 multicast router that I wrote since I couldn't find one in the ports tree). The vnet_host*_handler() methods are invoked in different VNET jails connected to the router; they register the connected epair with a multicast group and verify that they can send messages to each other. The tests are synchronized by sending messages over a unix domain socket. The flow is something like: 1) test startup_method() is called, the unix socket is created, 2) the superclass creates jails and links them together using the declared topology, 3) we wait for all child jails to start up and send a message on the unix socket indicating that they are ready 4) we start the routing daemon in the main jail, 5) the test actually starts; starttest() kicks off the vnet_host*_handlers(), which mostly just verify that they can send messages to each other using multicast packets 6) once they finish running, they signal their completion, and waittest() returns once they're all done There are two tests, repeated for v4 and v6. One just exchanges packets between two hosts, and the other has four hosts divided across two FIBs. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55244
* routing: Retire ROUTE_MPATH compile optionPouria Mousavizadeh Tehrani9 days2-2/+2
| | | | | | | | | | | The ROUTE_MPATH compile option was introduced to test the new multipath implementation. Since compiling it has no overhead and it's enabled by default, remove it. Reviewed by: melifaro, markj Relnotes: yes Differential Revision: https://reviews.freebsd.org/D55884
* tests: Add grand link-layer event in netinet6/ndpPouria Mousavizadeh Tehrani9 days1-0/+50
| | | | | | | Add test for ndp to verity link-layer address change event actually triggers the grand. Differential Revision: https://reviews.freebsd.org/D55927
* tests/netlink: Bugfix on snl_parse_errmsg_capped testK Rin9 days1-2/+2
| | | | | | | Turn off the NETLINK_EXT_ACK flag to fix bug of snl_parse_errmsg_capped. Reviewed by: pouria Pull Request: https://github.com/freebsd/freebsd-src/pull/1660
* timerfd: Guard expected performance failureJake Freeland10 days1-1/+2
| | | | | | | | | | During the timerfd__periodic_timer_performance test, only expect failures when the expiration count is less than 400000000. This prevents the test from being reported as a true failure in environments where scheduling latency is high enough to delay timerfd wakeups. Fixes: cb692380f1e0 ("timerfd: Expect periodic timer ...") MFC after: 1 week
* timerfd: Expect periodic timer performance failuresJake Freeland11 days2-4/+2
| | | | | | | | | | | | | | The current timerfd implementation fails to correctly count events on a nanosecond callout interval. The timerfd__periodic_timer_performance test detects this and reports failure. Mark this test as an expected failure so it isn't flagged by CI. A link to the bug report is attached to the test for reference. While we're here, clean up some minor style and Make issues. Fixes: 834c1ba793d9 ("timerfd: Add tests") MFC after: 1 week
* tests/netinet: add raw:reconnect testGleb Smirnoff11 days1-69/+168
| | | | | It tests repetitive connect(2) on AF_INET/SOCK_RAW including connect(2) to INADDR_ANY that puts socket back into receive-all mode.
* ipfw: skip tests if required sysctl is not setOlivier Cochard11 days1-1/+1
| | | | | | | | Since this is a configuration prerequisite rather than a test failure, use atf_skip instead. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D56069
* tests/netinet: add test for getsockname() on a disconnected TCP socketGleb Smirnoff12 days2-4/+37
| | | | | Stack it into existing file that exercises an other corner case of our TCP and rename the file to a more generic name.
* pf tests: verify that we handle address range rules correctlyKristof Provost12 days1-0/+38
| | | | | | | | There's been a problem where rules which differed only in address ranges were considered duplicates and not added. Test for this. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate")
* Revert "capsicum-test: remove stale file"Mariusz Zaborski13 days1-0/+1500
| | | | | | This was unintended, sorry. This reverts commit 20b99e3a147963c6ef715112bd38e349c7a5a459.
* capsicum-test: remove stale fileMariusz Zaborski13 days1-1500/+0
|
* pf tests: verify first-match-wins for nat rulesKristof Provost2026-03-221-0/+45
| | | | Sponsored by: Orange Business Services
* timerfd: Fix interval callout schedulingJake Freeland2026-03-201-0/+29
| | | | | | | | | | | | | | | | | When a timerfd interval callout misses its scheduled activation time, a differential is calculated based on the actual activation time and the scheduled activation time. This differential is divided by the timerfd's interval time and the quotient is added to the timerfd's counter. Before this change, the next callout was scheduled to activate at: scheduled activation time + timerfd interval. This change fixes the scheduling of the next callout to activate at: actual activation time + timerfd interval - remainder. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55790 MFC after: 2 weeks
* timerfd: Add testsJake Freeland2026-03-202-0/+1321
| | | | | | | | | Take Jan Kokemuller's timerfd tests from the epoll-shim project, stripping out code that isn't directly related to FreeBSD. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55789 MFC after: 2 weeks
* tests/netinet/raw: fix ssize_t printf(3) formatGleb Smirnoff2026-03-181-1/+1
| | | | Fixes: c1481c9f4a425db7295332be87f837bfb7d127df
* tests/netinet: provide test for raw_ip.c:rip_input()Gleb Smirnoff2026-03-182-0/+222
| | | | | | The test creates differently bound SOCK_RAW sockets and sends different probe packets. There is expected results matrix that every probe is checked against.
* tests/fusefs: fix sign-compare warning on armv7Siva Mahadevan2026-03-141-5/+5
| | | | | | | Fixes: 7e68af7ce2c1b892954df415774fe59fd2f1b62f Reviewed by: asomers Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D55846
* fusefs: redo vnode attribute lockingAlan Somers2026-03-124-22/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously most fields in fuse_vnode_data were protected by the vnode lock. But because DEBUG_VFS_LOCKS was never enabled by default until stable/15 the assertions were never checked, and many were wrong. Others were missing. This led to panics in stable/15 and 16.0-CURRENT, when a vnode was expected to be exclusively locked but wasn't, for fuse file systems that mount with "-o async". In some places it isn't possible to exclusively lock the vnode when accessing these fields. So protect them with a new mutex instead. This fixes panics and unprotected field accesses in VOP_READ, VOP_COPY_FILE_RANGE, VOP_GETATTR, VOP_BMAP, and FUSE_NOTIFY_INVAL_ENTRY. Add assertions everywhere the protected fields are accessed. Lock the vnode exclusively when handling FUSE_NOTIFY_INVAL_INODE. During fuse_vnode_setsize, if the vnode isn't already exclusively locked, use the vn_delayed_setsize mechanism. This fixes panics during VOP_READ or VOP_GETATTR. Also, ensure that fuse_vnop_rename locks the "from" vnode. Finally, reorder elements in struct fuse_vnode_data to reduce the structure size. Fixes: 283391 Reported by: kargl, markj, vishwin, Abdelkader Boudih, groenveld@acm.org MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D55230
* tests/kern/ssl_sendfile: fix 'random' and 'basic' flakynessGleb Smirnoff2026-03-101-8/+12
| | | | | | | | | | The read of c.sbytes needs to be synchronized with mutex. The problem was fixed for 'truncate' and 'grow' with 8a9508563542, but these two suffer from the same problem. Provide require_sbytes(), a locked wrapper around ATF_REQUIRE() to reduce copy and paste. Submitted by: olivier Differential Revision: https://reviews.freebsd.org/D55781
* tests/kern/ssl_sendfile: reduce copy & pasteGleb Smirnoff2026-03-101-12/+12
| | | | Provide sendme_locked_wait() for a common pattern. Not functional change.
* carp: fix global demotion counter to VRRP advertisementsOlivier Cochard2026-03-051-0/+61
| | | | | | | | | | | | | | | | | When net.inet.carp.preempt=1 and a physical interface goes down, the global V_carp_demotion counter is incremented. For CARP this was already reflected in outgoing advertisements via DEMOTE_ADVSKEW(), but VRRP sent the raw sc_vrrp_prio unchanged, so demotion had no effect. Add DEMOTE_VRRP_PRIO(), a macro analogous to DEMOTE_ADVSKEW(): It subtracts V_carp_demotion from the configured priority and clamps the result to [0, 254]. Priority 0 is VRRPv3's "resign" signal and causes backups to preempt immediately. Priority 255 (IP address owner) is never demoted. Reviewed by: kp Approved by: kp Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D55558
* tests/net/bpf: skip the bpf:inject test when RSS is presentGleb Smirnoff2026-03-051-0/+4
| | | | | With RSS the epair(4) may reorder packets making the test flaky. See net/if_epair.c:epair_select_queue().
* tests/net/bpf: hexdump(3) the packets if compare failsGleb Smirnoff2026-03-052-2/+6
|
* ipfw: add support for masked ip-address lookupsBoris Lytochkin2026-03-018-29/+665
| | | | | | | | | | | | | | | | | Current radix-based implementation of lookup tables in ipfw does not support non-contiguous prefixes while this type of lookup is needed to write CPU-effective firewall configurations. For some of the cases we can reach the goal using a masked table lookup by adding masked (e.g. zero non-significant bits) records into a table and then zero non-significant bits in lookup key prior to making a table lookup. Obtained from: Yandex LLC MFC after: 3 weeks Relnotes: yes Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D53694
* tests/kern: put ssl_sendfile under MK_OPENSSL != noGleb Smirnoff2026-02-261-1/+1
| | | | Reported by: wosch
* gre tests: Fix gcc warnings on gre netlink testsPouria Mousavizadeh Tehrani2026-02-201-7/+5
| | | | | | | | Avoid using `snl_add_msg_attr_ip` for now and directly use `snl_add_msg_attr_ip4` to silence gcc warnings. Fixes: e1e18cc12e68 Differential Revision: https://reviews.freebsd.org/D54443
* gre tests: Add required_kmods to gre netlink testPouria Mousavizadeh Tehrani2026-02-201-0/+1
| | | | | Fixes: e1e18cc12e68 Differential Revision: https://reviews.freebsd.org/D54443
* tests/ipfw: fix log:bpf test flakynessGleb Smirnoff2026-02-191-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | There were several problems: o Using 'netstat -B' is not a reliable way to make sure that all tcpdumps have attached to bpf(4). The problem is that tcpdump (via libpcap) does several ioctl(2)s after the attach including two BIOCSETF. Each of them flushes the input buffer. So we can see tcpdump attached in 'netstat -B' and start sending packets and the packet will be captured by bpf(4) before BIOCSETF and freed and tcpdump won't read anything. Instead of using netstat(1), use ps(1) and make sure each tcpdump is blocked on the "bpf" wait channel, which guarantees it is done with ioctl(2)s and is now blocked in read(2). o Using 'nc -w 0' sets timeout not only on the connect(2) (as documented) but also on poll(2), which is not documented. There is a race in shell that will make stdin not yet filled by 'echo foo' when nc(1) does poll(2). With zero timeout, this poll(2) will immediately return and nc will exit. o The waiting loop had two errors: using wrong variable name as well as invoking a subshell, that actually can't wait on the pid. o The reading tcpdump was lacking '-q' option, that prevents any protocol interpretations. Sometimes, when random port chosen by nc(1) would match some well-known (to tcpdump) port, the output would differ from the expected. PR: 293241
* if_gre: Add netlink support with testsPouria Mousavizadeh Tehrani2026-02-182-0/+174
| | | | | | | | Migrate to new if_clone KPI and implement netlink support for gre(4). Also refactor some of the gre specific ioctls. Reviewed by: glebius, zlei Differential Revision: https://reviews.freebsd.org/D54443
* ndp tests: Fix flakiness in ndp_slaac_default_routeMark Johnston2026-02-171-2/+5
| | | | | | | | | | | The test sends RAs in order to test SLAAC handling in another host. The router needs to also set net.inet6.ip6.forwarding=1, otherwise NAs sent from it have the ROUTER flag clear, and upon receiving such an NA the host will automatically delete routes learned from the router. Fixes: feda329622bc ("netinet6 tests: Add a regression test for default router handling") MFC after: 1 week Sponsored by: Klara, Inc.
* ndp tests: Fix an assertion in ndp_prefix_lifetime_extendMark Johnston2026-02-171-2/+2
| | | | | | | | | | | | | Here we have two interface addresses sharing a v6 prefix with finite lifetime. The intent was to make sure that adding the second address didn't cause the prefix's valid lifetime to drop from 20s to 10s, but of course, while the test is running it may drop from 20s to 19s, causing the test to fail spuriously. Relax the check a bit to avoid this. PR: 293152 Fixes: 74999aac5eff ("in6: Modify address prefix lifetimes when updating address lifetimes") MFC after: 1 week Sponsored by: Klara, Inc.
* capsicum-tests: remove Linux supportAlan Somers2026-02-1722-937/+55
| | | | | | | | | | | | Now that this project is part of freebsd-src, it no longer needs to be portable. Remove Linux-only tests, cross-os compatibility code, and compatibility with older FreeBSD versions. Leave in place some originally Linux-only tests that could now be ported to FreeBSD, like the pipe2 tests. Sponsored by: ConnectWise Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D54985
* aio(4) tests: do not rely on (int *)-1 being invalid addressAlan Somers2026-02-171-1/+6
| | | | | | Explicitly mmap guard and use it as the invalid address instead. MFC after: 1 week
* pdwait(2) tests: do not rely on (int *)-1 being invalid addressAlan Somers2026-02-171-3/+17
| | | | | | Explicitly mmap guard and use it as the invalid address instead. MFC after: 1 week
* pdrfork(2) tests: enable on x86Konstantin Belousov2026-02-161-9/+20
| | | | | | | | | | | Use pfrfork_thread(3) instead of pdrfork(RFSPAWN) to make tests working on x86. Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pdrfork(2) tests: should wait for the child to exitKonstantin Belousov2026-02-161-2/+3
| | | | | | | | Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pdrfork(2) tests: split basic_usageKonstantin Belousov2026-02-161-9/+19
| | | | | | | | | | | into pdrfork(2) call itself, and basic_usage_tail() that checks the pdrfork(2) results. Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pdrfork(2) tests: catch runaway child for EFAULT testKonstantin Belousov2026-02-161-0/+10
| | | | | | | | Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pdrfork(2) tests: do not rely on (int *)-1 being invalid addressKonstantin Belousov2026-02-161-2/+8
| | | | | | | | | | Explicitly mmap guard and use it as the invalid address instead. Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pdrfork(2) tests: RFPROCDESC|RFPROC are requiredKonstantin Belousov2026-02-161-44/+2
| | | | | | | | Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306
* pf: convert DIOCRTSTADDRS to netlinkKristof Provost2026-02-161-0/+38
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* atf_python/vnet: Make it possible to set the FIB of vnet interfacesMark Johnston2026-02-131-1/+15
| | | | | | | | Reviewed by: zlei, ngie MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D54972
* pf tests: verify blocked count on log interfaceKristof Provost2026-02-121-1/+13
| | | | | | | | Also check the IPv6 pass/block numbers. PR: 291763 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: fix use of uninitialised variableKristof Provost2026-02-031-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | In pf_match_rule() we attempt to append matching rules to the end of 'match_rules'. We want to preserve the order to make the multiple pflog entries easier to understand. So we keep track of the last added rule item in 'rt'. However, that assumed that 'match_rules' was only ever added to in that one call to pf_match_rules(). This isn't always the case, for example if we have match rules in different anchors. In that case we'd end up using the uninitialised 'rt' variable in the SLIST_INSERT_AFTER call. Instead track the match rules and the last matching rule (to enable easy appending) in the struct pf_test_ctx. This also allows us to reduce the number of arguments for some functions, because we passed a ctx to most functions that needed 'match_rules'. While here also make pf_match_rules() static, because it's only ever used in pf.c Add a test case to exercise the relevant code path. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate")
* tests/netgraph: fix tests that depended on connect(in6addr_any)Gleb Smirnoff2026-02-021-0/+3
| | | | Fixes: 627e126dbb07b167b028380ef61bb45f10493938
* atf_python: Run vnet handlers in $HOMEMark Johnston2026-02-021-0/+1
| | | | | | | | | | | | | | | When kyua runs a test, it creates a temp directory and sets $HOME to point to it. Tests are run with the cwd set to that temp directory. When a process attaches to a jail, its cwd is set to the root of the jail. Modify atf_python to cd to $HOME instead, so that it's easier for tests to share files. Reviewed by: zlei, ngie MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D54971
* tests: sys/capsicum/functional requires mqueuefsAlan Somers2026-01-311-0/+1
| | | | | | | | | | | | Skip this test if mqueuefs isn't loaded. Unfortunately, that will skip the entire googletest test program, including test cases that don't require mqueuefs. But the test's own skipping logic doesn't work, and we don't yet have a googletest-compatible require_kmods() function. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: emaste, ngie Differential Revision: https://reviews.freebsd.org/D54902
* tests/netinet: fix tests that depended on connect(in6addr_any)Gleb Smirnoff2026-01-301-0/+2
| | | | Fixes: 627e126dbb07b167b028380ef61bb45f10493938
* ip6_output tests: Remove an unused importMark Johnston2026-01-301-1/+0
| | | | | | | | No functional change intended. MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc.