From owner-svn-src-head@freebsd.org Fri Aug 17 15:02:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 026E11071A20; Fri, 17 Aug 2018 15:02:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6CE82193; Fri, 17 Aug 2018 15:02:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B0151FE2; Fri, 17 Aug 2018 15:02:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7HF2wON078649; Fri, 17 Aug 2018 15:02:58 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7HF2wSq078648; Fri, 17 Aug 2018 15:02:58 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201808171502.w7HF2wSq078648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 17 Aug 2018 15:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337971 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 337971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 15:02:59 -0000 Author: kp Date: Fri Aug 17 15:02:58 2018 New Revision: 337971 URL: https://svnweb.freebsd.org/changeset/base/337971 Log: pf tests: Verify that pf limits the number of fragments per packet Test the limitation on number of frames per packet introduced in pf in r337969. Sponsored by: Klara Systems Modified: head/tests/sys/netpfil/pf/fragmentation.sh Modified: head/tests/sys/netpfil/pf/fragmentation.sh ============================================================================== --- head/tests/sys/netpfil/pf/fragmentation.sh Fri Aug 17 15:00:41 2018 (r337970) +++ head/tests/sys/netpfil/pf/fragmentation.sh Fri Aug 17 15:02:58 2018 (r337971) @@ -2,6 +2,49 @@ . $(atf_get_srcdir)/utils.subr +atf_test_case "too_many_fragments" "cleanup" + +too_many_fragments_head() +{ + atf_set descr 'IPv4 fragment limitation test' + atf_set require.user root +} + +too_many_fragments_body() +{ + pft_init + + epair=$(pft_mkepair) + pft_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 + + ifconfig ${epair}b mtu 200 + jexec alcatraz ifconfig ${epair}a mtu 200 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "scrub all fragment reassemble" + + # So we know pf is limiting things + jexec alcatraz sysctl net.inet.ip.maxfragsperpacket=1024 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # We can ping with < 64 fragments + atf_check -s exit:0 -o ignore ping -c 1 -s 800 192.0.2.2 + + # Too many fragments should fail + atf_check -s exit:2 -o ignore ping -c 1 -s 20000 192.0.2.2 +} + +too_many_fragments_cleanup() +{ + pft_cleanup +} + atf_test_case "v6" "cleanup" v6_head() { @@ -70,5 +113,6 @@ v6_cleanup() atf_init_test_cases() { + atf_add_test_case "too_many_fragments" atf_add_test_case "v6" }