git: 407930b9f9bb - stable/12 - pf tests: Test PR259689
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 01 Dec 2021 17:10:09 UTC
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=407930b9f9bbfc10164677ed0732e867a871a513 commit 407930b9f9bbfc10164677ed0732e867a871a513 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-11-08 12:28:43 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2021-12-01 12:43:25 +0000 pf tests: Test PR259689 We didn't populate dyncnt/tblcnt, so `pfctl -sr -vv` might not have the table element count. PR: 259689 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32893 (cherry picked from commit 2de49deeca0b1377664dee2cd0a43ee7cf6b4bc4) --- lib/libpfctl/libpfctl.c | 2 +- tests/sys/netpfil/pf/table.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6613708b183c..9252f64969bb 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -294,7 +294,7 @@ pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) if (addr->type == PF_ADDR_DYNIFTL) { strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); - addr->p.dyncnt = nvlist_get_number(nvl, "dynctl"); + addr->p.dyncnt = nvlist_get_number(nvl, "dyncnt"); } if (addr->type == PF_ADDR_TABLE) { strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"), diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index ff2a68b81224..41ff4e3da84e 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -214,6 +214,34 @@ automatic_cleanup() pft_cleanup } +atf_test_case "pr259689" "cleanup" +pr259689_head() +{ + atf_set descr 'Test PR 259689' + atf_set require.user root +} + +pr259689_body() +{ + pft_init + + vnet_mkjail alcatraz + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass in" \ + "block in inet from { 1.1.1.1, 1.1.1.2, 2.2.2.2, 2.2.2.3, 4.4.4.4, 4.4.4.5 }" + + atf_check -o match:'block drop in inet from <__automatic_.*:6> to any' \ + -e ignore \ + jexec alcatraz pfctl -sr -vv +} + +pr259689_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" @@ -221,4 +249,5 @@ atf_init_test_cases() atf_add_test_case "pr251414" atf_add_test_case "network" atf_add_test_case "automatic" + atf_add_test_case "pr259689" }