From nobody Mon Sep 15 11:54:25 2025 X-Original-To: dev-commits-src-main@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 4cQNjt19RHz67Fg9; Mon, 15 Sep 2025 11:54:26 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQNjs34nZz44Fp; Mon, 15 Sep 2025 11:54:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757937265; 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=+CRd18LE9luJlPyfDdrPrKED+PyuEFwOL0QT7gS4oMI=; b=DcOc5QOTy2NWRrDHMlIRjB9lUb6TDxpqW48xt4c7cGlYHqS5onVNjv1ytwCNXrEtDjHHPk 89IQtLZQxgET1CRXY+zFBMeDbDiRUCSITxv+vmD0+dhdRe+AizB8FI194k6xW0DSFUksum 2Fyy82LmGRoviHP8CtEyV4r+ZdOSGJ30JA7mGxTg7Ievy48tfEt3U27U9qsD6XRu3rJN5k EsucVVeK8ZlO8yp3ediUZ67KsslxpC88xZWNj/9MxA43ESclTbMtkTBXmsYfEQMyutojDY tp4sztIhb/ufgnPJhY5QkC26q81oQK/3eYkuq94AcceFXrCMTsUmjfXxSqc2gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757937265; 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=+CRd18LE9luJlPyfDdrPrKED+PyuEFwOL0QT7gS4oMI=; b=IpWJNIN11q2Jt+WD4MosnXK8ppr07jv+e3cff3DK9NxyYfOQSZbSSvgP0tG9K/0qujP+rf 55z8YTFssW3tYnAaenBshr3c6HEsefFyJC2WWLLh9HPtgm2w2veNbT1u2IJG+x7sATC/y4 7aw6tyCuLoN2uhgrJuCkQRd6ieWYf4PHHkFjpsLVxwrdfOYx3tlo3gaG4+nqdb0ZhT8tpf L33/gt01z7GHTJeMwc3YFS51Z8uuU/1yWDSPHAAfS+n9ztfcuKhEG5oiGUg3BaTdQhbjF+ OIbMrk13o77s4HqgBY04+VHle/qmvRByyLoq0DezbdGLpJ+unwWFm48It3lciw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757937265; a=rsa-sha256; cv=none; b=c5pRJljlQKF+o/m8zvKePIng0f/9ewWhAT5pj7W2BlbB/jGmg5A/mDNPn0wftI0xrxo9zK YJD36W1VLRVWO1pfAb4UZKtTjO6aFkiqe1to8JBfpiKpiJDH9n0aQySRygzcvnpM04V5hj sSzw0qgbSDO6J9z4oYbBRch8+OKj8C4VdyUkRQsbCHS+/bC2P7oZfWDlxOdW2cNbPmNBci Dp/v80Xcpx/MB6cpwwKW2PIT2L6lm66rBe2pwtemudzkuBdvpYQC7LKl3fHHnuR6qb07aX 9IsMqCvR7VpSleEHFVvJSBbhHrM/8EV8sHJMwuQ2bgf2L57dTVgRpXeI8oCFqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cQNjs2Xb4zt9y; Mon, 15 Sep 2025 11:54:25 +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 58FBsP5r025444; Mon, 15 Sep 2025 11:54:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58FBsPZv025441; Mon, 15 Sep 2025 11:54:25 GMT (envelope-from git) Date: Mon, 15 Sep 2025 11:54:25 GMT Message-Id: <202509151154.58FBsPZv025441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5e89648ee68e - main - pf tests: test fragment counters List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 5e89648ee68e44d01d00d41d53b6934c604f8c50 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5e89648ee68e44d01d00d41d53b6934c604f8c50 commit 5e89648ee68e44d01d00d41d53b6934c604f8c50 Author: Kristof Provost AuthorDate: 2025-08-21 08:10:08 +0000 Commit: Kristof Provost CommitDate: 2025-09-15 09:32:35 +0000 pf tests: test fragment counters Ensure that the fragmentation counters work as expected. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/fragmentation_pass.sh | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/sys/netpfil/pf/fragmentation_pass.sh b/tests/sys/netpfil/pf/fragmentation_pass.sh index 5deaba18301d..c749aac793ee 100644 --- a/tests/sys/netpfil/pf/fragmentation_pass.sh +++ b/tests/sys/netpfil/pf/fragmentation_pass.sh @@ -648,6 +648,72 @@ dummynet_fragmented_cleanup() pft_cleanup } +atf_test_case "counters" "cleanup" +counters_head() +{ + atf_set descr 'Test fragment counters' + atf_set require.user root +} + +counters_body() +{ + pft_init + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}a + + ifconfig ${epair}b inet 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}a 192.0.2.2/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set reassemble yes" \ + "pass keep state" + + # All fragment counters are zero + counters=$(jexec alcatraz pfctl -si -v | grep -A 4 '^Fragments') + atf_check -s exit:0 -o match:"current entries[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"searches[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"inserts[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"removals[[:space:]]+0" \ + echo $counters + + # They remain zero after we've seen non-fragmented traffic + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.2 + counters=$(jexec alcatraz pfctl -si -v | grep -A 4 '^Fragments') + atf_check -s exit:0 -o match:"current entries[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"searches[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"inserts[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"removals[[:space:]]+0" \ + echo $counters + + # But once we've reassembled they're no longer zero + # (Count is 2, because in + out) + atf_check -s exit:0 -o ignore \ + ping -c 1 -s 2000 192.0.2.2 + counters=$(jexec alcatraz pfctl -si -v | grep -A 4 '^Fragments') + atf_check -s exit:0 -o match:"current entries[[:space:]]+0" \ + echo $counters + atf_check -s exit:0 -o match:"searches[[:space:]]+2" \ + echo $counters + atf_check -s exit:0 -o match:"inserts[[:space:]]+2" \ + echo $counters + atf_check -s exit:0 -o match:"removals[[:space:]]+2" \ + echo $counters +} + +counters_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "too_many_fragments" @@ -665,4 +731,5 @@ atf_init_test_cases() atf_add_test_case "dummynet" atf_add_test_case "dummynet_nat" atf_add_test_case "dummynet_fragmented" + atf_add_test_case "counters" }