git: e4f6850ec42f - stable/12 - pf tests: Provoke failure in pf_ioctl_addrule

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 04 Feb 2022 14:23:23 UTC
The branch stable/12 has been updated by kp:

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

commit e4f6850ec42f979404071644d4f4442fdf8f7d38
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-01-16 07:59:27 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-02-04 10:38:16 +0000

    pf tests: Provoke failure in pf_ioctl_addrule
    
    MFC after:      3 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 4ca41937606064c78a4f5725bb0b2ba021cfd7c3)
---
 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());
 }