Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2025 19:39:13 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e736f6df1ec1 - main - pf tests: fix test skipping when pf is not loaded
Message-ID:  <202502121939.51CJdDcD061845@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e736f6df1ec1d2f5a846a20cec8744cf843daf78

commit e736f6df1ec1d2f5a846a20cec8744cf843daf78
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-02-12 17:38:30 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-02-12 19:38:39 +0000

    pf tests: fix test skipping when pf is not loaded
    
    Two test cases in table.sh didn't call pft_init and thus didn't skip if pf is
    not loaded.
    The fragmentation_pass:v6_route_to test had the test body in the cleanup
    function, so got run even when pf was not loaded.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/fragmentation_pass.sh | 10 +++++-----
 tests/sys/netpfil/pf/table.sh              |  4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/sys/netpfil/pf/fragmentation_pass.sh b/tests/sys/netpfil/pf/fragmentation_pass.sh
index e72b065b77bb..9255e6f738cf 100644
--- a/tests/sys/netpfil/pf/fragmentation_pass.sh
+++ b/tests/sys/netpfil/pf/fragmentation_pass.sh
@@ -165,11 +165,6 @@ v6_route_to_head()
 v6_route_to_body()
 {
 	pft_init
-}
-
-v6_route_to_cleanup()
-{
-	pft_cleanup
 
 	epair_send=$(vnet_mkepair)
 	epair_link=$(vnet_mkepair)
@@ -224,6 +219,11 @@ v6_route_to_cleanup()
 		ping -6 -c 1 -b 70000 -s 65000 2001:db8:43::3
 }
 
+v6_route_to_cleanup()
+{
+	pft_cleanup
+}
+
 atf_test_case "mtu_diff" "cleanup"
 mtu_diff_head()
 {
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 3b7e116720f3..a3d00f8cdb14 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -172,6 +172,8 @@ ctime_to_unixtime()
 
 zero_one_body()
 {
+	pft_init
+
 	epair_send=$(vnet_mkepair)
 	ifconfig ${epair_send}a 192.0.2.1/24 up
 	ifconfig ${epair_send}a inet alias 192.0.2.3/24
@@ -243,6 +245,8 @@ reset_nonzero_head()
 
 reset_nonzero_body()
 {
+	pft_init
+
 	epair_send=$(vnet_mkepair)
 	ifconfig ${epair_send}a 192.0.2.1/24 up
 	ifconfig ${epair_send}a inet alias 192.0.2.3/24



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502121939.51CJdDcD061845>