summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2018-10-28 05:37:15 +0000
committerKristof Provost <kp@FreeBSD.org>2018-10-28 05:37:15 +0000
commit71f8908a1a49f7cb8fb4aa09670782fae017979e (patch)
tree56be5ae3fb15284ac121d829804d00a5105ac1dc /tests
parent99eb00558a73186924b3dce77c96687bb0cb6b48 (diff)
downloadsrc-test2-71f8908a1a49f7cb8fb4aa09670782fae017979e.tar.gz
src-test2-71f8908a1a49f7cb8fb4aa09670782fae017979e.zip
Notes
Diffstat (limited to 'tests')
-rwxr-xr-xtests/sys/netpfil/pf/pass_block.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh
index 9eeb89b17037..bb49036235d9 100755
--- a/tests/sys/netpfil/pf/pass_block.sh
+++ b/tests/sys/netpfil/pf/pass_block.sh
@@ -84,8 +84,54 @@ v6_cleanup()
pft_cleanup
}
+atf_test_case "noalias" "cleanup"
+noalias_head()
+{
+ atf_set descr 'Test the :0 noalias option'
+ atf_set require.user root
+}
+
+noalias_body()
+{
+ pft_init
+
+ epair=$(pft_mkepair)
+ ifconfig ${epair}a inet6 2001:db8:42::1/64 up no_dad
+
+ pft_mkjail alcatraz ${epair}b
+ jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 up no_dad
+
+ linklocaladdr=$(jexec alcatraz ifconfig ${epair}b inet6 \
+ | grep %${epair}b \
+ | awk '{ print $2; }' \
+ | cut -d % -f 1)
+
+ # Sanity check
+ atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
+ atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 ${linklocaladdr}%${epair}a
+
+ jexec alcatraz pfctl -e
+ pft_set_rules alcatraz "block out inet6 from (epair0b:0) to any"
+
+ atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
+
+ # We should still be able to ping the link-local address
+ atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 ${linklocaladdr}%${epair}a
+
+ pft_set_rules alcatraz "block out inet6 from (epair0b) to any"
+
+ # We cannot ping to the link-local address
+ atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 ${linklocaladdr}%${epair}a
+}
+
+noalias_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "v4"
atf_add_test_case "v6"
+ atf_add_test_case "noalias"
}