From nobody Fri Jun 21 11:49:33 2024 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 4W5FyQ1BdQz5NX5G; Fri, 21 Jun 2024 11:49:34 +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 4W5FyQ0fzGz4Z5F; Fri, 21 Jun 2024 11:49:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718970574; 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=MIxzl+QdJuR2Ly3zcJ1FYN+AMgCw0nSWvK/FKXAoA+o=; b=cVpKhli0kuh7I9HQX+IV4bgh/vqYU8pYN0UHovpgBs+SvYpNqFKghQGZBf42JFvJwoWobp tco7Wikb8MnrFuU2d3wxyaGqPQxg4nUNMcPY5e2xrRUltgSWLH8wWooo06Wr4F/q+ZTFx5 M0al5uQK4RGJGToDSaj8KqCRqYrdNRbwxtLZfcfuXjAgvOOiiWbLqv+A0RPRUd48p/Xn/h dZZs5tfV8Vz3dgc4oI3HUZjY8HMBzRp8NwmdSMzeIozkkbgrAT3T2spTRUWivhdp1DyPqJ uGehFM1oaIh9nAXuqjJj35mKtWLID75yl+fKbAOgtW+NJbQ/Z91FP8SHZsvJzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718970574; a=rsa-sha256; cv=none; b=tBfLmInrUHqAlShtBqGnr4WoBlL5syWMOfZ7GYkWhd/O64a+QIgKgKDSd+ZJRfgrOB6uva vn5MzMy/lg24o3pHWrFs+ALhT3Mxvx9JJ14hyq1c7Btd++pMEIc6nVkXOC2RzCRkBCPcj2 ZpB7B+8shX4O31IDLWZle6KRFkwDeBpRBPmD5u3D9nT1o5dQkvw43Q1EADR2fhhFH7WbMY suGclKY1PANsndhLiB1OMN3tuPukHJ1BX/MC4RiMMwbA8F+lHp0YQlaYGg+FY7xuABKkt+ jmwmOYQ1e+PuErpHqX5dB5Djm8gSkaV3dJ7qho/OdbikT1c/HXSFRF8JxODJDQ== 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=1718970574; 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=MIxzl+QdJuR2Ly3zcJ1FYN+AMgCw0nSWvK/FKXAoA+o=; b=jSed5WwST7IO5zBpBdepavYGTZbm5VPrv5tUpwVqPzLeL/cAM3uynE6NSPDR7cPt4T9upw FeNWMETaHY/SQY+7AWdUxpOAFektKgFBijVcKiz0CHdCTnLeoq5l5ARlzLmMUM/MzYKILu y+A/iIIqSAmdEoAlxo6tvO91d/qBHjIdMozFFNiMZc9CPktMgtyMdWNT7yDWTnHbQaeYan D4BAaQrsElxvDjcEcX8vbzkEat6tiUYFZ/uYTl6Mkgt7xX3hQyo19dcA+hE3zv1oLUHeqT RZfbBRG3PZAG/RPYkvnvi/CV1Yxng4XtnnfGvBPbPhdiPuaIQp6Z7Wobw+afCA== 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 4W5FyQ0CdDz16WS; Fri, 21 Jun 2024 11:49:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45LBnXrX075988; Fri, 21 Jun 2024 11:49:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45LBnXRu075985; Fri, 21 Jun 2024 11:49:33 GMT (envelope-from git) Date: Fri, 21 Jun 2024 11:49:33 GMT Message-Id: <202406211149.45LBnXRu075985@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: 025df3e6a0c3 - main - pf tests: test keepcounters when we exceed 32 bits 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: 025df3e6a0c3a4477dd55153543f395bc018dd37 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=025df3e6a0c3a4477dd55153543f395bc018dd37 commit 025df3e6a0c3a4477dd55153543f395bc018dd37 Author: Kristof Provost AuthorDate: 2024-06-10 10:11:02 +0000 Commit: Kristof Provost CommitDate: 2024-06-21 11:49:17 +0000 pf tests: test keepcounters when we exceed 32 bits Ensure that we correctly transfer byte counts if the value exceeds what can be stored in a single 32-bit counter. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/rules_counter.sh | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/rules_counter.sh b/tests/sys/netpfil/pf/rules_counter.sh index 962e7c93ba93..98f96a7adca1 100644 --- a/tests/sys/netpfil/pf/rules_counter.sh +++ b/tests/sys/netpfil/pf/rules_counter.sh @@ -148,6 +148,54 @@ keepcounters_body() jexec alcatraz pfctl -s r -v } +atf_test_case "4G" "cleanup" +4G_head() +{ + atf_set descr 'Test keepcounter for values above 32 bits' + atf_set require.user root +} + +4G_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 nc -l 1234 >/dev/null & + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "pass all" + + # Now pass more than 4GB of data + dd if=/dev/zero bs=1k count=4M | nc -N 192.0.2.2 1234 + + bytes=$(jexec alcatraz pfctl -s r -v | awk '/Bytes:/ { print $7; }') + if [ $bytes -lt 4000000000 ]; + then + atf_fail "Expected to see > 4GB" + fi + + # Set new rules, keeping counters + pft_set_rules noflush alcatraz \ + "set keepcounters" \ + "pass all" + + bytes=$(jexec alcatraz pfctl -s r -v | awk '/Bytes:/ { print $7; }') + if [ $bytes -lt 4000000000 ]; + then + atf_fail "Expected to see > 4GB after rule reload" + fi +} + +4G_cleanup() +{ + pft_cleanup +} + keepcounters_cleanup() { pft_cleanup @@ -157,4 +205,5 @@ atf_init_test_cases() { atf_add_test_case "get_clear" atf_add_test_case "keepcounters" + atf_add_test_case "4G" }