Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jan 2021 22:18:48 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f0cb921e361a - stable/12 - netpfil tests: Move pft_ping.py and sniffer.py to the common test directory
Message-ID:  <202101032218.103MImf5020423@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0cb921e361a8dcefec6c469839e26e6d79f958f

commit f0cb921e361a8dcefec6c469839e26e6d79f958f
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2019-08-19 10:48:27 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-01-03 20:26:49 +0000

    netpfil tests: Move pft_ping.py and sniffer.py to the common test directory
    
    The pft_ping.py and sniffer.py tool is moved from tests/sys/netpfil/pf to
    tests/sys/netpfil/common directory because these tools are to be used in
    common for all the firewalls.
    
    Submitted by:   Ahsan Barkati
    Reviewed by:    kp, thj
    Sponsored by:   Google, Inc. (GSoC 2019)
    Differential Revision:  https://reviews.freebsd.org/D21276
    
    (cherry picked from commit 9531253098a1b889520b49a98af0bb81a2373ac0)
---
 ObsoleteFiles.inc                            |  3 +++
 tests/sys/netpfil/common/Makefile            | 13 +++++++++++++
 tests/sys/netpfil/{pf => common}/pft_ping.py |  0
 tests/sys/netpfil/{pf => common}/sniffer.py  |  0
 tests/sys/netpfil/pf/Makefile                |  3 ---
 tests/sys/netpfil/pf/forward.sh              | 18 ++++++++++--------
 tests/sys/netpfil/pf/set_tos.sh              | 14 ++++++++------
 7 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 622d1b79f557..3c505f9610f4 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -1100,6 +1100,9 @@ OLD_FILES+=usr/lib/clang/8.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_
 OLD_DIRS+=usr/lib/clang/8.0.0/lib/freebsd
 OLD_DIRS+=usr/lib/clang/8.0.0/lib
 OLD_DIRS+=usr/lib/clang/8.0.0
+# 20190817: pft_ping.py and sniffer.py moved to /usr/tests/sys/netpfil/common
+OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py
+OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py
 # 20190509: tests/sys/opencrypto requires the net/py-dpkt package.
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.py
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.pyc
diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile
new file mode 100644
index 000000000000..9e2fa132c84f
--- /dev/null
+++ b/tests/sys/netpfil/common/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PACKAGE=	tests
+
+TESTSDIR=	${TESTSBASE}/sys/netpfil/common
+
+${PACKAGE}FILES+=	\
+		pft_ping.py \
+		sniffer.py
+
+${PACKAGE}FILESMODE_pft_ping.py=	0555
+
+.include <bsd.test.mk>
diff --git a/tests/sys/netpfil/pf/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py
similarity index 100%
rename from tests/sys/netpfil/pf/pft_ping.py
rename to tests/sys/netpfil/common/pft_ping.py
diff --git a/tests/sys/netpfil/pf/sniffer.py b/tests/sys/netpfil/common/sniffer.py
similarity index 100%
rename from tests/sys/netpfil/pf/sniffer.py
rename to tests/sys/netpfil/common/sniffer.py
diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile
index 474b3c3b9b4b..8e38ccf341de 100644
--- a/tests/sys/netpfil/pf/Makefile
+++ b/tests/sys/netpfil/pf/Makefile
@@ -23,12 +23,9 @@ ATF_TESTS_SH+=	anchor \
 
 ${PACKAGE}FILES+=	utils.subr \
 			echo_inetd.conf \
-			sniffer.py \
-			pft_ping.py \
 			CVE-2019-5597.py \
 			CVE-2019-5598.py
 
-${PACKAGE}FILESMODE_pft_ping.py=	0555
 ${PACKAGE}FILESMODE_CVE-2019-5597.py=	0555
 ${PACKAGE}FILESMODE_CVE-2019-5598.py=	0555
 
diff --git a/tests/sys/netpfil/pf/forward.sh b/tests/sys/netpfil/pf/forward.sh
index 0c97d9601cdc..0d9c9d7787a3 100755
--- a/tests/sys/netpfil/pf/forward.sh
+++ b/tests/sys/netpfil/pf/forward.sh
@@ -2,6 +2,8 @@
 
 . $(atf_get_srcdir)/utils.subr
 
+common_dir=$(atf_get_srcdir)/../common
+
 atf_test_case "v4" "cleanup"
 v4_head()
 {
@@ -39,20 +41,20 @@ v4_body()
 
 	# Forward with pf enabled
 	pft_set_rules alcatraz "block in"
-	atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a
 
 	pft_set_rules alcatraz "block out"
-	atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recv ${epair_recv}a
 
 	# Allow ICMP
 	pft_set_rules alcatraz "block in" "pass in proto icmp"
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a
@@ -90,7 +92,7 @@ v6_body()
 	route add -6 2001:db8:43::/64 2001:db8:42::2
 
 	# Sanity check, can we forward ICMP echo requests without pf?
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--ip6 \
 		--sendif ${epair_send}a \
 		--to 2001:db8:43::3 \
@@ -101,7 +103,7 @@ v6_body()
 	# Block incoming echo request packets
 	pft_set_rules alcatraz \
 		"block in inet6 proto icmp6 icmp6-type echoreq"
-	atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 ${common_dir}/pft_ping.py \
 		--ip6 \
 		--sendif ${epair_send}a \
 		--to 2001:db8:43::3 \
@@ -110,7 +112,7 @@ v6_body()
 	# Block outgoing echo request packets
 	pft_set_rules alcatraz \
 		"block out inet6 proto icmp6 icmp6-type echoreq"
-	atf_check -s exit:1 -e ignore $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 -e ignore ${common_dir}/pft_ping.py \
 		--ip6 \
 		--sendif ${epair_send}a \
 		--to 2001:db8:43::3 \
@@ -120,7 +122,7 @@ v6_body()
 	pft_set_rules alcatraz \
 		"block out" \
 		"pass out inet6 proto icmp6"
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--ip6 \
 		--sendif ${epair_send}a \
 		--to 2001:db8:43::3 \
@@ -130,7 +132,7 @@ v6_body()
 	pft_set_rules alcatraz \
 		"block out inet6 proto icmp6 icmp6-type echoreq" \
 		"pass in proto icmp"
-	atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 ${common_dir}/pft_ping.py \
 		--ip6 \
 		--sendif ${epair_send}a \
 		--to 2001:db8:43::3 \
diff --git a/tests/sys/netpfil/pf/set_tos.sh b/tests/sys/netpfil/pf/set_tos.sh
index 246c7e1724da..4f92456cf40d 100755
--- a/tests/sys/netpfil/pf/set_tos.sh
+++ b/tests/sys/netpfil/pf/set_tos.sh
@@ -2,6 +2,8 @@
 
 . $(atf_get_srcdir)/utils.subr
 
+common_dir=$(atf_get_srcdir)/../common
+
 atf_test_case "v4" "cleanup"
 v4_head()
 {
@@ -33,7 +35,7 @@ v4_body()
 
 	# No change is done if not requested
 	pft_set_rules alcatraz "scrub out proto icmp"
-	atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \
@@ -41,7 +43,7 @@ v4_body()
 
 	# The requested ToS is set
 	pft_set_rules alcatraz "scrub out proto icmp set-tos 42"
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \
@@ -49,7 +51,7 @@ v4_body()
 
 	# ToS is not changed if the scrub rule does not match
 	pft_set_rules alcatraz "scrub out proto tcp set-tos 42"
-	atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:1 -o ignore ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \
@@ -58,14 +60,14 @@ v4_body()
 	# Multiple scrub rules match as expected
 	pft_set_rules alcatraz "scrub out proto tcp set-tos 13" \
 		"scrub out proto icmp set-tos 14"
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \
 		--expect-tos 14
 
 	# And this works even if the packet already has ToS values set
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \
@@ -74,7 +76,7 @@ v4_body()
 
 	# ToS values are unmolested if the packets do not match a scrub rule
 	pft_set_rules alcatraz "scrub out proto tcp set-tos 13"
-	atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+	atf_check -s exit:0 ${common_dir}/pft_ping.py \
 		--sendif ${epair_send}a \
 		--to 198.51.100.3 \
 		--recvif ${epair_recv}a \



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