From nobody Thu May 12 19:58:16 2022 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 5D95B1ADE9BC; Thu, 12 May 2022 19:58:17 +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 4KzjJ86F1nz4YW4; Thu, 12 May 2022 19:58:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652385497; 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=INGLU1QWLkCPpZgZDqyawA8Z0mj014zxNnpMbRmV2cY=; b=W/lC2av85bIgkjqmYJHSdp+kknJR4K4/Okw0fM6jm0OQggksG1qPlslfa68qXpPN4VCNB0 MdOzd8DxySOdnTVXjuASRbbDfW3O5I6gucKVkQek1sEKXy135kywDFhqSp1XAe19naN/2L SNrAL9opajSwk2vQek0qRiQsqIBPRYtQ2kWq9cN+T2z6BtODZJsNVb6vF+y8XPWuLWkO5l OcTwOvXWHE0LT342qbHODPP/4dDHShx0t3glMRfI4CkRTOKRQu/3N9ZOoQcZF2O8AVVDlt V8gMAHSeXeILD1zJN0raPsyMxPLKodcxiulwe9abgiokPjbCAx9WCNYeyQ1vNw== 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 6FB9F14ACE; Thu, 12 May 2022 19:58:16 +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 24CJwGbi075635; Thu, 12 May 2022 19:58:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24CJwGiX075634; Thu, 12 May 2022 19:58:16 GMT (envelope-from git) Date: Thu, 12 May 2022 19:58:16 GMT Message-Id: <202205121958.24CJwGiX075634@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: 920c3410872c - main - pf tests: test dummynet on route-to'd packets 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: 920c3410872c93f0ca97dcc4c96a134746eb9393 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652385497; 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=INGLU1QWLkCPpZgZDqyawA8Z0mj014zxNnpMbRmV2cY=; b=aT7v8dsQga2lU5znbZ/0BLhihKKcY+reXVrs9ITwafnjAhVMsxHGStMm1wuI0/yWkp1snQ wHuSTS/nuEhnkfKy/zo/O9m2k2xK6SqlqPMH+7cYJbtUs61TTxaeZPDz+bCrC8qoWX0tBh ecC7US0ej0Dm0+HohffsWKzbHeSNv1zEycOT1MXfqDAx3bAZI+SRXt9F/kosODfq8/mRpb C29cMqErogOl4NBImfri9124Kxz4uZnlsxZ1gJsOzEKSPH53ikQU4OryOwLCzENVlkqMjL ZgdbiD1Pk+WdELqlRVkJ2IBRtvVv9kfwbxWPm43UV4RY4yNNYUyuKe9cTID67A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652385497; a=rsa-sha256; cv=none; b=BRPUvToyCnKHQ+1oBnbG3Hly7YRYA3H+XJTbfHkzeftIO1fpbaeN22lZRlAkY42dnaElCm NxIsfDLbD5lwvXGnaLQRjoF1gG4etXC4tz8UTupkSlUQT4qAi5JDg1m1AeO5jG0hl+c7nC RHcrRIgHHIXeS4mKEvjpX7cWA2tzP9VeayX6aZdWwT4r1iM7IeepsW/1EIJ/rc+LQPV0Gn JByIVxjiE9cR5uWYDSM1VMWTgkKsKtgsRXdbACqOFe1XTvYd+T3/w0de4Hb3mk1VxMsAv0 B7QC/doGpXPIWnstq8CwfGIKWP4+9RkRkto93USk5q+1Wwu4qwangaVji2HMLQ== 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=920c3410872c93f0ca97dcc4c96a134746eb9393 commit 920c3410872c93f0ca97dcc4c96a134746eb9393 Author: Kristof Provost AuthorDate: 2022-05-09 10:36:53 +0000 Commit: Kristof Provost CommitDate: 2022-05-12 19:50:10 +0000 pf tests: test dummynet on route-to'd packets Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35161 --- tests/sys/netpfil/pf/route_to.sh | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 570d1feb36ff..f77b9a35b8ad 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -309,6 +309,62 @@ icmp_nat_cleanup() pft_cleanup } +atf_test_case "dummynet" "cleanup" +dummynet_head() +{ + atf_set descr 'Test that dummynet applies to route-to packets' + atf_set require.user root +} + +dummynet_body() +{ + dummynet_init + + epair_srv=$(vnet_mkepair) + epair_gw=$(vnet_mkepair) + + vnet_mkjail srv ${epair_srv}a + jexec srv ifconfig ${epair_srv}a 192.0.2.1/24 up + jexec srv route add default 192.0.2.2 + + vnet_mkjail gw ${epair_srv}b ${epair_gw}a + jexec gw ifconfig ${epair_srv}b 192.0.2.2/24 up + jexec gw ifconfig ${epair_gw}a 198.51.100.1/24 up + jexec gw sysctl net.inet.ip.forwarding=1 + + ifconfig ${epair_gw}b 198.51.100.2/24 up + route add -net 192.0.2.0/24 198.51.100.1 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1 + + jexec gw dnctl pipe 1 config delay 1200 + pft_set_rules gw \ + "pass out route-to (${epair_srv}b 192.0.2.1) to 192.0.2.1 dnpipe 1" + jexec gw pfctl -e + + # The ping request will pass, but take 1.2 seconds + # So this works: + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + # But this times out: + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.1 + + # return path dummynet + pft_set_rules gw \ + "pass out route-to (${epair_srv}b 192.0.2.1) to 192.0.2.1 dnpipe (0, 1)" + + # The ping request will pass, but take 1.2 seconds + # So this works: + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + # But this times out: + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.1 +} + +dummynet_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" @@ -316,4 +372,5 @@ atf_init_test_cases() atf_add_test_case "multiwan" atf_add_test_case "multiwanlocal" atf_add_test_case "icmp_nat" + atf_add_test_case "dummynet" }