xref: /freebsd/tests/sys/netpfil/pf/anchor.sh (revision 06aac31aecb6028d346abc6b6cd54f58c12a1a32)
155177f18SKristof Provost# $FreeBSD$
255177f18SKristof Provost
355177f18SKristof Provost. $(atf_get_srcdir)/utils.subr
455177f18SKristof Provost
555177f18SKristof Provostatf_test_case "pr183198" "cleanup"
655177f18SKristof Provostpr183198_head()
755177f18SKristof Provost{
855177f18SKristof Provost	atf_set descr 'Test tables referenced by rules in anchors'
955177f18SKristof Provost	atf_set require.user root
1055177f18SKristof Provost}
1155177f18SKristof Provost
1255177f18SKristof Provostpr183198_body()
1355177f18SKristof Provost{
1455177f18SKristof Provost	pft_init
1555177f18SKristof Provost
16*06aac31aSKristof Provost	epair=$(vnet_mkepair)
17*06aac31aSKristof Provost	vnet_mkjail alcatraz ${epair}b
1855177f18SKristof Provost	jexec alcatraz pfctl -e
1955177f18SKristof Provost
2055177f18SKristof Provost	# Forward with pf enabled
2155177f18SKristof Provost	pft_set_rules alcatraz  \
2255177f18SKristof Provost		"table <test> { 10.0.0.1, 10.0.0.2, 10.0.0.3 }" \
2355177f18SKristof Provost		"block in" \
2455177f18SKristof Provost		"anchor \"epair\" on ${epair}b { \n\
2555177f18SKristof Provost			pass in from <test> \n\
2655177f18SKristof Provost		}"
2755177f18SKristof Provost
2855177f18SKristof Provost	atf_check -s exit:0 -o ignore jexec alcatraz pfctl -sr -a '*'
2955177f18SKristof Provost	atf_check -s exit:0 -o ignore jexec alcatraz pfctl -t test -T show
3055177f18SKristof Provost}
3155177f18SKristof Provost
3255177f18SKristof Provostpr183198_cleanup()
3355177f18SKristof Provost{
3455177f18SKristof Provost	pft_cleanup
3555177f18SKristof Provost}
3655177f18SKristof Provost
3755177f18SKristof Provostatf_init_test_cases()
3855177f18SKristof Provost{
3955177f18SKristof Provost	atf_add_test_case "pr183198"
4055177f18SKristof Provost}
41