1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

pf tests: check counters on anchors

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost 2024-11-18 14:40:01 +01:00
parent 10343013a4
commit 5eee34fa03

View File

@ -233,6 +233,44 @@ quick_cleanup()
pft_cleanup
}
atf_test_case "counter" "cleanup"
counter_head()
{
atf_set descr 'Test counters on anchors'
atf_set require.user root
}
counter_body()
{
pft_init
epair=$(vnet_mkepair)
vnet_mkjail alcatraz ${epair}a
ifconfig ${epair}b 192.0.2.2/24 up
jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up
# Sanity check
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
jexec alcatraz pfctl -e
pft_set_rules alcatraz \
"anchor \"foo\" {\n\
pass\n\
}"
# Generate traffic
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
atf_check -s exit:0 -e ignore \
-o match:'[ Evaluations: 1 Packets: 2 Bytes: 168 States: 1 ]' \
jexec alcatraz pfctl -sr -vv
}
counter_cleanup()
{
pft_cleanup
}
atf_init_test_cases()
{
atf_add_test_case "pr183198"
@ -241,4 +279,5 @@ atf_init_test_cases()
atf_add_test_case "wildcard"
atf_add_test_case "nested_label"
atf_add_test_case "quick"
atf_add_test_case "counter"
}