Date: Mon, 28 Feb 2022 15:39:08 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: dff227195bac - stable/12 - pf tests: Test per-anchor tables Message-ID: <202202281539.21SFd8UT085372@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dff227195bac2d2c199566786598317939558971 commit dff227195bac2d2c199566786598317939558971 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2022-02-17 13:13:50 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2022-02-26 08:26:15 +0000 pf tests: Test per-anchor tables MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2) --- tests/sys/netpfil/pf/table.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index 3d57fba8d2fb..07e830b92e16 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -277,6 +277,48 @@ precreate_cleanup() pft_cleanup } +atf_test_case "anchor" "cleanup" +anchor_head() +{ + atf_set descr 'Test tables in anchors' + atf_set require.user root +} + +anchor_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + (echo "table <testtable> persist" + echo "block in quick from <testtable> to any" + ) | jexec alcatraz pfctl -a anchorage -f - + + pft_set_rules noflush alcatraz \ + "pass" \ + "anchor anchorage" + + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Tables belong to anchors, so this is a different table and won't affect anything + jexec alcatraz pfctl -t testtable -T add 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # But when we add the address to the table in the anchor it does block traffic + jexec alcatraz pfctl -a anchorage -t testtable -T add 192.0.2.1 + atf_check -s exit:2 -o ignore ping -c 1 192.0.2.2 +} + +anchor_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" @@ -286,4 +328,5 @@ atf_init_test_cases() atf_add_test_case "automatic" atf_add_test_case "pr259689" atf_add_test_case "precreate" + atf_add_test_case "anchor" }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202281539.21SFd8UT085372>