From nobody Thu Apr 3 16:42:54 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 4ZT6wv38xgz5s8CJ; Thu, 03 Apr 2025 16:42:55 +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 4ZT6wv17CVz4HgT; Thu, 03 Apr 2025 16:42:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743698575; 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=QuUX8OR6Roo/oltdnZBBgjmcXPJE725k1WuELF123bU=; b=KMs7eae61c2xX2DAyQofMGfj3WBtQUjudszTGlkjoqtJafEzIk/kqivEft6pc87k+s7azn SBWGfL8OYcaVv/wMzBQvGhzZda5rp7JRvVGEjJjpFGwVcPHU7r0r0Ea7ExdjfXWyVcT5Dp pJloMq1myrrL9ITReStjw4o9WFeyxSU+tC2gEX2whP2CQmiNuSQb+YuqWhbCdpwtPSEiub nijuccnCQ2/EpmyvlPGyEDoEbO9AcMrJrKlzMzTZu5UQ5R1EakeO1J86RQQ3X78eGNeSLV Km3JE1bb7z4gzjFU1E7uKayhLhY3Kw8z0sC/juNeIStHOAhqJeO40Ijp1DoBtw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743698575; a=rsa-sha256; cv=none; b=oMc2W44fN1C9CS9h/bfOfwlhkB5/4P8pzkct8qanMCHYIczyUZIeSYLOEM3vXr4ieIyhuT 9KYZfSlX36irl17G6TFZwrWMdt0NK2OMjehviGfX/NB7UArr+CNw6hF8yHYWrwBQ69y31k w5lthsXQ6Iw33UsbR3hUeNn1JdRYxCgIqvs8BjNztzPnqVuesWSjcSPxQaJYrcBTMRq0vS jcGovnKZOcM0xFhX3V2Yo4mRv9B0Lx8MfRP/OPzSY8JpHIZW4Br8gKESVwMf7DbQ6PXmEk HV2mhh6cwMKzh7aTWsOVdhP/P7Ng8JfuoD7DaWtZeHohCaU6XJ4hgeumDF4vLg== 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=1743698575; 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=QuUX8OR6Roo/oltdnZBBgjmcXPJE725k1WuELF123bU=; b=q/SQjbh8ldBFYpBb6D56RBwz/iO6xU2BELenK4r1kn6wc2iqTafjIThlpzPR5AuR5a8Ce/ mqxayXpNrrl730fdTO9kRaoV+qGuDUDU0rym4WzF0ZRECIr6MrWuKjtxmL3WSf2V0JAtPx YsQQyVXC3woJ8JcWkKdhE/bqF8XFnelalEsQ1CfqacxU+4Wc0rCMendGVkb2+zbwltL+1m xnkYh9c4SRmFe3UZyaEAwzAkyF5xhBwvmTVWyLPVttlDphP4lANAAcGnlb/cVFABj2IrkP zJVcc3g5XR5vUlP4lu/zqx2VWPBAfrmZjeoVr+99MXd7q1d9YWTbhWRSbTc7cA== 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 4ZT6wv0krVz17kD; Thu, 03 Apr 2025 16:42:55 +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 533GgtXf022553; Thu, 3 Apr 2025 16:42:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 533GgsFZ022550; Thu, 3 Apr 2025 16:42:54 GMT (envelope-from git) Date: Thu, 3 Apr 2025 16:42:54 GMT Message-Id: <202504031642.533GgsFZ022550@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: 7fa5f4995f06 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 7fa5f4995f0657c9992bf09df43b2a815938b33d Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7fa5f4995f0657c9992bf09df43b2a815938b33d commit 7fa5f4995f0657c9992bf09df43b2a815938b33d Author: Kristof Provost AuthorDate: 2025-03-20 01:27:52 +0000 Commit: Kristof Provost CommitDate: 2025-04-03 16:41:25 +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" }