pf tests: Test per-anchor tables
MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
7f55a9b490
commit
7d3fc84b2d
@ -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 "network"
|
||||
atf_add_test_case "pr259689"
|
||||
atf_add_test_case "precreate"
|
||||
atf_add_test_case "anchor"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user