Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2021 19:49:49 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: a599304a6c7f - stable/13 - pf tests: Test automatically generated tables
Message-ID:  <202105101949.14AJnn7T006457@gitrepo.freebsd.org>

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

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

commit a599304a6c7f82b84beae2763acea4c0ea1e0dcf
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-04-26 09:14:44 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-05-10 19:45:57 +0000

    pf tests: Test automatically generated tables
    
    Add a test case where the pfctl optimizer will generate a table
    automatically. These tables have long names, which we accidentally broke
    in the nvlist ADDRULE ioctl.
    
    Reviewed by:    melifaro
    MFC after:      2 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D29989
    
    (cherry picked from commit 08d77308211f823b8532d27790e8fd29eaf75c77)
---
 tests/sys/netpfil/pf/table.sh | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
index 516895ae1759..379b715e767a 100644
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -177,10 +177,48 @@ network_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "automatic" "cleanup"
+automatic_head()
+{
+	atf_set descr "Test automatic - optimizer generated - tables"
+	atf_set require.user root
+}
+
+automatic_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
+
+	pft_set_rules alcatraz \
+		"block in" \
+		"pass in proto icmp from 192.0.2.1" \
+		"pass in proto icmp from 192.0.2.3" \
+		"pass in proto icmp from 192.0.2.4" \
+		"pass in proto icmp from 192.0.2.5" \
+		"pass in proto icmp from 192.0.2.6" \
+		"pass in proto icmp from 192.0.2.7" \
+		"pass in proto icmp from 192.0.2.8" \
+		"pass in proto icmp from 192.0.2.9"
+
+	atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2
+}
+
+automatic_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "v4_counters"
 	atf_add_test_case "v6_counters"
 	atf_add_test_case "pr251414"
 	atf_add_test_case "network"
+	atf_add_test_case "automatic"
 }



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