Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Mar 2019 10:33:47 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r344965 - stable/12/tests/sys/netpfil/pf
Message-ID:  <201903091033.x29AXl4O054103@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Sat Mar  9 10:33:47 2019
New Revision: 344965
URL: https://svnweb.freebsd.org/changeset/base/344965

Log:
  MFC r339836, r340286, r341358:
  
  pf tests: Test ':0' ignoring link-local addresses
  
  Fix test: sys.netpfil.pf.pass_block.noalias
  
  Replace hard-coded epair0b with the variable holds the real epair interface
  used for testing.
  
  pf tests: Make pass_block:noalias more robust
  
  Send several ICMPv6 echo requests. We've seen occasional failures with a
  single request.
  
  PR:		201695

Modified:
  stable/12/tests/sys/netpfil/pf/pass_block.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/netpfil/pf/pass_block.sh
==============================================================================
--- stable/12/tests/sys/netpfil/pf/pass_block.sh	Sat Mar  9 10:28:36 2019	(r344964)
+++ stable/12/tests/sys/netpfil/pf/pass_block.sh	Sat Mar  9 10:33:47 2019	(r344965)
@@ -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 3 -x 1 2001:db8:42::2
+	atf_check -s exit:0 -o ignore ping6 -c 3 -x 1 ${linklocaladdr}%${epair}a
+
+	jexec alcatraz pfctl -e
+	pft_set_rules alcatraz "block out inet6 from (${epair}b:0) to any"
+
+	atf_check -s exit:2 -o ignore ping6 -c 3 -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 3 -x 1 ${linklocaladdr}%${epair}a
+
+	pft_set_rules alcatraz "block out inet6 from (${epair}b) to any"
+
+	# We cannot ping to the link-local address
+	atf_check -s exit:2 -o ignore ping6 -c 3 -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"
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903091033.x29AXl4O054103>