git: 4ca419376060 - main - pf tests: Provoke failure in pf_ioctl_addrule

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Sun, 16 Jan 2022 11:48:13 UTC
The branch main has been updated by kp:

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

commit 4ca41937606064c78a4f5725bb0b2ba021cfd7c3
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-01-16 07:59:27 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-01-16 08:04:59 +0000

    pf tests: Provoke failure in pf_ioctl_addrule
    
    MFC after:      3 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/ioctl/validation.c | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/sys/netpfil/pf/ioctl/validation.c b/tests/sys/netpfil/pf/ioctl/validation.c
index 0d7f7631e91b..947193599b31 100644
--- a/tests/sys/netpfil/pf/ioctl/validation.c
+++ b/tests/sys/netpfil/pf/ioctl/validation.c
@@ -832,6 +832,44 @@ ATF_TC_CLEANUP(tag, tc)
 	COMMON_CLEANUP();
 }
 
+ATF_TC_WITH_CLEANUP(rpool_mtx);
+ATF_TC_HEAD(rpool_mtx, tc)
+{
+	atf_tc_set_md_var(tc, "require.user", "root");
+}
+
+ATF_TC_BODY(rpool_mtx, tc)
+{
+	struct pfioc_rule rule;
+
+	COMMON_HEAD();
+
+	memset(&rule, 0, sizeof(rule));
+
+	rule.ticket = 0;
+	rule.pool_ticket = 0;
+	rule.anchor[0] = 0;
+
+	rule.rule.return_icmp = 0;
+	bzero(&rule.rule.src, sizeof(rule.rule.src));
+	bzero(&rule.rule.dst, sizeof(rule.rule.dst));
+
+	rule.rule.ifname[0] = 0;
+	rule.rule.action = 0;
+	rule.rule.rtableid = 0;
+
+	rule.rule.tagname[0] = 0;
+	rule.rule.action = 42;
+
+	ioctl(dev, DIOCADDRULE, &rule);
+}
+
+ATF_TC_CLEANUP(rpool_mtx, tc)
+{
+	COMMON_CLEANUP();
+}
+
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, addtables);
@@ -854,6 +892,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, commit);
 	ATF_TP_ADD_TC(tp, getsrcnodes);
 	ATF_TP_ADD_TC(tp, tag);
+	ATF_TP_ADD_TC(tp, rpool_mtx);
 
 	return (atf_no_error());
 }