mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-14 20:37:06 +00:00
pf tests: test wildcard anchors
Ensure that a wildcard anchor actually includes any nested anchors (i.e.
foo/* will call into foo/bar).
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36414
(cherry picked from commit d5a0bf4517
)
This commit is contained in:
parent
df4d33ecaa
commit
15d30ce3fa
|
@ -93,8 +93,47 @@ nested_anchor_cleanup()
|
|||
pft_cleanup
|
||||
}
|
||||
|
||||
atf_test_case "wildcard" "cleanup"
|
||||
wildcard_head()
|
||||
{
|
||||
atf_set descr 'Test wildcard anchors for functionality'
|
||||
atf_set require.user root
|
||||
}
|
||||
|
||||
wildcard_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 \
|
||||
"block" \
|
||||
"anchor \"foo/*\""
|
||||
|
||||
atf_check -s exit:2 -o ignore ping -c 1 192.0.2.1
|
||||
|
||||
echo "pass" | jexec alcatraz pfctl -g -f - -a "foo/bar"
|
||||
|
||||
jexec alcatraz pfctl -sr -a "*"
|
||||
atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1
|
||||
}
|
||||
|
||||
wildcard_cleanup()
|
||||
{
|
||||
pft_cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case "pr183198"
|
||||
atf_add_test_case "nested_anchor"
|
||||
atf_add_test_case "wildcard"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue