From owner-dev-commits-src-all@freebsd.org Sat Jul 31 13:03:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9404265C0AA; Sat, 31 Jul 2021 13:03:58 +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 4GcPbd2g5vz4SbZ; Sat, 31 Jul 2021 13:03:57 +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 2CFDD193BE; Sat, 31 Jul 2021 13:03:57 +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 16VD3vrM066636; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3vN4066635; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:57 GMT Message-Id: <202107311303.16VD3vN4066635@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: 4f2821ab53db - stable/12 - pf tests: Test the match keyword 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: 4f2821ab53dbfbe08ecf02caff78afff54bdedaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2821ab53dbfbe08ecf02caff78afff54bdedaa commit 4f2821ab53dbfbe08ecf02caff78afff54bdedaa Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:31 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 (cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0) --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" }