From nobody Wed Mar 02 16:00:58 2022 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 87C1019E11F7; Wed, 2 Mar 2022 16:01:01 +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 4K7zP75dC3z3NMw; Wed, 2 Mar 2022 16:00:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646236860; 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=AIF+N0AYT9TURd9U+mcwlCZ6TE1u7mCXkR+J+dDfF3M=; b=Fp034oaqQGnDbhzyuLpsT6kJhaFs242Q/uibKpW9nkXdbbo71v9eu6DF35Qw52EPZKluTy MgMep//GaJZJl4PVRcc76YU+n11nnH6rPta5kaBx4CneGP7vNyJ7dW0B+bJLYsKQNd7iMw l0uJYnIas11SFhbDKyT/72tG+IEyepGBlpm8G25yMcQqe6XYDBhEgA7UhBJ4N9FtlbZOh9 E/fLKVvEC9VpOHHFLVzz30P6G4ro9qNLG7jTOGD0Kmj0bwoftI1K4jfCxwr8l++jbRwlV6 dya5nHg1nEXPIVB1TJmKbcHTvVIdmMo5YqQZtBLvZzQxzSkRSwhWhJPKYIlEPA== 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 5759125E56; Wed, 2 Mar 2022 16:00:58 +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 222G0w6r091331; Wed, 2 Mar 2022 16:00:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222G0wvw091330; Wed, 2 Mar 2022 16:00:58 GMT (envelope-from git) Date: Wed, 2 Mar 2022 16:00:58 GMT Message-Id: <202203021600.222G0wvw091330@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: 0faafc2185f0 - main - pf tests: test dummynet for ether traffic 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: 0faafc2185f032fdbf42a5f424286de7b68269f6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646236860; 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=AIF+N0AYT9TURd9U+mcwlCZ6TE1u7mCXkR+J+dDfF3M=; b=e+TbHzT3cH+/FdKZcDBgb4951qKzJtWP+H5Y87HJ3LVh7/5+pWf6kopTu/Sxvr+24KBKEJ 6T+iVbseysalSGnnkt4MGJ4vVQAe2BizIsKvkxlOwc++4+B3gT5o/ruGaio/Fz/FJq/Hz6 Fa/n5wTO5tsk7d4Wt3iUxwv1bd1w9A3HFY6qH9aU5CdtukcZyOR15fEPH4QkysVxVsrpX8 UXNtIDZAKo6oKTD/rsanAOrqpdlJDVIsbqxeBaAZMLd3BFUwHtJuCkiemTWY1jLR3dqSgn PJz/6VxaHpq7guJwoP2YQtcoWykFrzQYO7AY1J3YZzqDSxzRbkir+vxQ1EqmoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646236860; a=rsa-sha256; cv=none; b=YF/3+9t6meRKw29w8kQYg+TxrurYs6czwsKhy+FaMoEXlPhRfiIkC8OQ0GM0ejsGTJ7vlu nTiJw3Oaf+z4P0D5USx5oR+AWHCu36fLFcnanN2icIAo3fd/nEfNoUjZZAR8RG8Kx+Gi2j q0S24cqX6EkZ4DnpegVVeMPeT91D1WToy709FAk/+h6CN38p/SYXY5akmQLGLrRImCNqHu vKDsvoTjeNN6IIwUaPc7PsNIEdyk/ovBkoRwa9VPWLBHBOBMuZdx1QxkElaCCQOSr+GcmU 0PhB5BS9fXDnsBr6r4+usNKKYrsOOwpvpgk8T08biUmAw3KZ/lzpZHfS6CC/Fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0faafc2185f032fdbf42a5f424286de7b68269f6 commit 0faafc2185f032fdbf42a5f424286de7b68269f6 Author: Kristof Provost AuthorDate: 2021-09-28 16:21:26 +0000 Commit: Kristof Provost CommitDate: 2022-03-02 16:00:06 +0000 pf tests: test dummynet for ether traffic Test that we can set dummynet information on L2, which is processed by L3 later (assuming it's not overruled by L3 rules, of course). Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32223 --- tests/sys/netpfil/pf/ether.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh index 340eb079ca23..a7e23779396f 100644 --- a/tests/sys/netpfil/pf/ether.sh +++ b/tests/sys/netpfil/pf/ether.sh @@ -280,10 +280,55 @@ captive_cleanup() pft_cleanup } +atf_test_case "dummynet" "cleanup" +dummynet_head() +{ + atf_set descr 'Test dummynet for L2 traffic' + atf_set require.user root +} + +dummynet_body() +{ + pft_init + + if ! kldstat -q -m dummynet; then + atf_skip "This test requires dummynet" + fi + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec alcatraz 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 alcatraz dnctl pipe 1 config bw 30Byte/s + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "ether pass in dnpipe 1" + + # 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 +} + +dummynet_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "mac" atf_add_test_case "proto" atf_add_test_case "direction" atf_add_test_case "captive" + atf_add_test_case "dummynet" }