git: df64ca1bfcd3 - stable/15 - tests/mac_ipacl: restore sysctls after modification
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Oct 2025 13:26:40 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=df64ca1bfcd32b19196c8b99b2b8e78520ef7f7c
commit df64ca1bfcd32b19196c8b99b2b8e78520ef7f7c
Author: Siva Mahadevan <me@svmhdvn.name>
AuthorDate: 2025-07-15 16:45:24 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-10-15 13:23:03 +0000
tests/mac_ipacl: restore sysctls after modification
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
(cherry picked from commit 79042fd7ed4187d2a74e37618f6fd77f448ca353)
---
tests/sys/mac/ipacl/Makefile | 5 +++++
tests/sys/mac/ipacl/ipacl_test.sh | 16 ++++++++++++----
tests/sys/mac/ipacl/utils.subr | 4 ----
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/tests/sys/mac/ipacl/Makefile b/tests/sys/mac/ipacl/Makefile
index e083f6c1a69c..93b29e250ea5 100644
--- a/tests/sys/mac/ipacl/Makefile
+++ b/tests/sys/mac/ipacl/Makefile
@@ -6,4 +6,9 @@ ATF_TESTS_SH+= ipacl_test
${PACKAGE}FILES+= utils.subr
+.for t in ${ATF_TESTS_SH}
+TEST_METADATA.$t+= required_kmods="mac_ipacl"
+TEST_METADATA.$t+= is_exclusive="true"
+.endfor
+
.include <bsd.test.mk>
diff --git a/tests/sys/mac/ipacl/ipacl_test.sh b/tests/sys/mac/ipacl/ipacl_test.sh
index 0de1b414857b..892f4c154b66 100644
--- a/tests/sys/mac/ipacl/ipacl_test.sh
+++ b/tests/sys/mac/ipacl/ipacl_test.sh
@@ -40,6 +40,9 @@ ipacl_v4_body()
{
ipacl_test_init
+ prev_ipacl_ipv4="$(sysctl -n security.mac.ipacl.ipv4)"
+ prev_ipacl_rules="$(sysctl -n security.mac.ipacl.rules)"
+
epairA=$(vnet_mkepair)
epairB=$(vnet_mkepair)
epairC=$(vnet_mkepair)
@@ -130,8 +133,9 @@ ipacl_v4_body()
atf_check -s not-exit:0 -e ignore \
jexec A ifconfig ${epairA}b 203.0.113.1/24 up
- # Reset rules OID.
- sysctl security.mac.ipacl.rules=
+ # Reset sysctls.
+ sysctl security.mac.ipacl.rules="${prev_ipacl_rules}"
+ sysctl security.mac.ipacl.ipv4="${prev_ipacl_ipv4}"
}
ipacl_v4_cleanup()
@@ -151,6 +155,9 @@ ipacl_v6_body()
{
ipacl_test_init
+ prev_ipacl_ipv6="$(sysctl -n security.mac.ipacl.ipv6)"
+ prev_ipacl_rules="$(sysctl -n security.mac.ipacl.rules)"
+
epairA=$(vnet_mkepair)
epairB=$(vnet_mkepair)
epairC=$(vnet_mkepair)
@@ -265,8 +272,9 @@ ipacl_v6_body()
atf_check -s not-exit:0 -e ignore jexec A ifconfig \
${epairA}b inet6 2001:db8::abcd/32 up
- # Reset rules OID.
- sysctl security.mac.ipacl.rules=
+ # Reset sysctls.
+ sysctl security.mac.ipacl.rules="${prev_ipacl_rules}"
+ sysctl security.mac.ipacl.ipv6="${prev_ipacl_ipv6}"
}
ipacl_v6_cleanup()
diff --git a/tests/sys/mac/ipacl/utils.subr b/tests/sys/mac/ipacl/utils.subr
index 1d80414bafea..2fff8b1862da 100644
--- a/tests/sys/mac/ipacl/utils.subr
+++ b/tests/sys/mac/ipacl/utils.subr
@@ -5,10 +5,6 @@
ipacl_test_init()
{
vnet_init
-
- if ! kldstat -q -m mac_ipacl; then
- atf_skip "mac_ipacl is not loaded"
- fi
}
ipacl_test_cleanup()