From nobody Thu Apr 3 16:43:06 2025 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 4ZT6x732C6z5s8ft; Thu, 03 Apr 2025 16:43:07 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZT6x644l3z4J3F; Thu, 03 Apr 2025 16:43:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743698586; 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=nUHsz9t2Blv7buWGJwHLavDL2PC5/M1n+M+3z0+LPhs=; b=kJ8s8+SdmKGqLvpdn1Gveanw8s15/hzy3o8k/93dOPBrk9ZsB0yx1jjl5n4nQTdSMzjhle dI7uD4Masd0WR84yby+kVWppPQ6CjzO2O9NBWyQwp1NsUWYfOcYMwiqMWRcMX8PD9ku5mN bAEuAsxZoupWEKYOg1SK+/rSkpTbhmsiL3Dff6WSrsu71IONTRQofDPKgUOEW8fTOiXDbT KjixHdWRGbjm2+t8oqAlbBY73nFer+KqJyo0l8fp9PueqcLbd2o0EpxhRW/+npCh3waUGA eMpG3UofdArpMZFHAk5HSzXg2OqsxPIIDJcm+IjWY5UGoyj44kAyi8M6SFOJhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743698586; a=rsa-sha256; cv=none; b=K5yrfp/SJPel/apI0oJ3B8Kzu3mBM2x3QMM1GwyoozCkI5rB8e+C1sXrK4It05p2zAXIsj np5h2GagKac4jhhDnH2tjxm5qDOM36q7bGH05hbsezo7M9aU5CAT6UgsmCQrBxyX5mwFY0 Jgg0I6ccJSu/uhVLjZthrjxcpv2Rm0fjyEn+K7TJATwfCD3OMXaB4Z9q9pt6MPkHsY+IUV 5unWUuEK/0X3fJMwnKxJuk9KfpAZU6G1V8eSaKyHY+4bC0NlEIxLPgqw3ZzOwvBJmMeyu7 KnUayFrQXGSoiVKIU4dALMSt5loR33NL08f6Cubk1GUL/q70B8TgTPojXtlIHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743698586; 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=nUHsz9t2Blv7buWGJwHLavDL2PC5/M1n+M+3z0+LPhs=; b=UFaJ7NVNWV2sPLhHJ1h+LBIllCp7abB5gtbi/GzqksZbdSBo2Jh4f8PRtoN+un57vyiX3P mFBYE4T0nnxvAGLcef31u9vJ31LiF5pTwMPNtTAHAf2oUY5Uw5m43EEq2ImTDkVlE/wDTR S2nKzi5T0W2M3zMiL+3hj6xQfxMeciL90YAuUf64cCxQwK1uvuJJ2h0riMpOGsaHivaxPV 4TYo7hP2vLYGsM6hWmRoj+NcV1JaZUMySwJahg5RRBMepMbJW3oZGa9eGeCZKiK++lQbXq A8b0OUcr2tbo20Lzo7EazMms37z8phhq2GRMAd7wmiLzB4/4iYRBRxNypDhnvA== 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 4ZT6x63hMzz1806; Thu, 03 Apr 2025 16:43:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 533Gh60I022821; Thu, 3 Apr 2025 16:43:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 533Gh6rw022818; Thu, 3 Apr 2025 16:43:06 GMT (envelope-from git) Date: Thu, 3 Apr 2025 16:43:06 GMT Message-Id: <202504031643.533Gh6rw022818@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: 42aa0d02c281 - stable/13 - pf tests: test table information export via snmp_pf 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/13 X-Git-Reftype: branch X-Git-Commit: 42aa0d02c281d790c77ce18789ccab20e9274260 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=42aa0d02c281d790c77ce18789ccab20e9274260 commit 42aa0d02c281d790c77ce18789ccab20e9274260 Author: Kristof Provost AuthorDate: 2025-03-20 01:27:52 +0000 Commit: Kristof Provost CommitDate: 2025-04-03 05:58:58 +0000 pf tests: test table information export via snmp_pf Event: Tokyo Hackathon 202503 (cherry picked from commit 36586800803d24f1137d861bbaf487a6bde16a09) --- tests/sys/netpfil/pf/snmp.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/sys/netpfil/pf/snmp.sh b/tests/sys/netpfil/pf/snmp.sh index 0d6b2eb10ec7..37cc4b75cf92 100644 --- a/tests/sys/netpfil/pf/snmp.sh +++ b/tests/sys/netpfil/pf/snmp.sh @@ -65,7 +65,59 @@ basic_cleanup() pft_cleanup } +atf_test_case "table" "cleanup" +table_head() +{ + atf_set descr 'Test tables and pf_snmp' + atf_set require.user root +} + +table_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}b 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}a + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "table counters { 192.0.2.0/24 }" \ + "pass in from " + + # Start bsnmpd after creating the table so we don't have to wait for + # a refresh timeout + jexec alcatraz bsnmpd -c $(atf_get_srcdir)/bsnmpd.conf + + # Sanity check, and create state + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + # We should have one table + atf_check -s exit:0 -o match:'pfTablesTblNumber.0 = 1' \ + bsnmpwalk -s public@192.0.2.1 -i pf_tree.def begemot + + # We have the 'foo' table + atf_check -s exit:0 -o match:'pfTablesTblDescr.* = foo' \ + bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables + + # Which contains address 192.0.2.0/24 + atf_check -s exit:0 -o match:'pfTablesAddrNet.* = 192.0.2.0' \ + bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables + atf_check -s exit:0 -o match:'pfTablesAddrPrefix.* = 24' \ + bsnmpwalk -s public@192.0.2.1 -i pf_tree.def pfTables +} + +table_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "table" }