From nobody Wed Dec 01 17:10:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 402D518CB593; Wed, 1 Dec 2021 17:10:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J45Dy450Kz4dNB; Wed, 1 Dec 2021 17:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CE795B0F; Wed, 1 Dec 2021 17:10:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B1HA92Z017108; Wed, 1 Dec 2021 17:10:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B1HA9k7017105; Wed, 1 Dec 2021 17:10:09 GMT (envelope-from git) Date: Wed, 1 Dec 2021 17:10:09 GMT Message-Id: <202112011710.1B1HA9k7017105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 407930b9f9bb - stable/12 - pf tests: Test PR259689 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 407930b9f9bbfc10164677ed0732e867a871a513 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638378610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=amtP3prWdg2fdioZLTDQLgJ701LUHtEDpO1TZdYdOlw=; b=Y6+kS+2G5EIUK3gU4qWvW+u2UozfOWzisXo9wbOjxj2dQDsw/QxmpJW8NDGiRzG8khLP6V eCR9cFCh/HuH6OGUiX9aqpIZDpmQgIakT37/7EWn5cmk40bLfGKGUrZKVRsj3bAPzgVGRd xneen5ulz50xdSJfACV27Ib9FEmu/T1cb2Np8pvQE9a1FLfdBQXgn2e7f1+8R37RmiD5ey 46O76gVk5EDi2YOJTU3bdJVnqi5gMKISxHmgqNcYYElkyUNTRWWl+fst9S6irdeWUAHV4V kJxQ04uMPNsltJCt6ejLLXL7MTwrr9YDcLl36AuB76s7oRbXz2XrdPSnaQP0KA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638378610; a=rsa-sha256; cv=none; b=petTMSinyuwSb5uYQSrLscfNrqldO8qs4SIXwrAANHTVpwxoDn8nWMiCJ2cbB0Iub0QMTK GgpLoo8WyZmpyB+/MYJ3aPHYw2sL79oglhjvHmS4gw89RCDgUHCQ+mW2Aoi/vaPsnyLVgJ XRRapVvKD9RXFegsFfpT03pAapnrC+oEH8mYCZkLzrYFH6/G3Tqnvd+BOAV9V5e41nMZ5+ ph6mfGU6ot2j5445TL6Y9Sx8kaAE9IqdzkOUCk3w1mxe/rfZYgsmxcRzgDbDaCfJelKfhF sSVys2nW6UMub8Ab+x3Dt8KX+4SZeO3cyzp/ywY/MdOsgBQKcfYo2A8HIEo9nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=407930b9f9bbfc10164677ed0732e867a871a513 commit 407930b9f9bbfc10164677ed0732e867a871a513 Author: Kristof Provost AuthorDate: 2021-11-08 12:28:43 +0000 Commit: Kristof Provost CommitDate: 2021-12-01 12:43:25 +0000 pf tests: Test PR259689 We didn't populate dyncnt/tblcnt, so `pfctl -sr -vv` might not have the table element count. PR: 259689 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32893 (cherry picked from commit 2de49deeca0b1377664dee2cd0a43ee7cf6b4bc4) --- lib/libpfctl/libpfctl.c | 2 +- tests/sys/netpfil/pf/table.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6613708b183c..9252f64969bb 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -294,7 +294,7 @@ pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) if (addr->type == PF_ADDR_DYNIFTL) { strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); - addr->p.dyncnt = nvlist_get_number(nvl, "dynctl"); + addr->p.dyncnt = nvlist_get_number(nvl, "dyncnt"); } if (addr->type == PF_ADDR_TABLE) { strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"), diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh index ff2a68b81224..41ff4e3da84e 100644 --- a/tests/sys/netpfil/pf/table.sh +++ b/tests/sys/netpfil/pf/table.sh @@ -214,6 +214,34 @@ automatic_cleanup() pft_cleanup } +atf_test_case "pr259689" "cleanup" +pr259689_head() +{ + atf_set descr 'Test PR 259689' + atf_set require.user root +} + +pr259689_body() +{ + pft_init + + vnet_mkjail alcatraz + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass in" \ + "block in inet from { 1.1.1.1, 1.1.1.2, 2.2.2.2, 2.2.2.3, 4.4.4.4, 4.4.4.5 }" + + atf_check -o match:'block drop in inet from <__automatic_.*:6> to any' \ + -e ignore \ + jexec alcatraz pfctl -sr -vv +} + +pr259689_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" @@ -221,4 +249,5 @@ atf_init_test_cases() atf_add_test_case "pr251414" atf_add_test_case "network" atf_add_test_case "automatic" + atf_add_test_case "pr259689" }