git: b3fa36efe797 - main - pf tests: extend ethernet dummynet test

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 20 May 2022 12:51:18 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b3fa36efe797445cb0b4fd26d79226836db2a2b3

commit b3fa36efe797445cb0b4fd26d79226836db2a2b3
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-05-18 15:29:35 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-05-20 12:49:31 +0000

    pf tests: extend ethernet dummynet test
    
    Extend the existing ethernet dummynet test to also test dummynet on the
    outbound direction.
    This used to be a problem as traffic shaping wasn't done in the ethernet
    code. It merely tagged the packet and left shaping up to the layer 3 pf
    code. This works in the inbound direction, but not for outbound traffic
    where we hit the L3 code first and only then the L2 code.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D35258
---
 tests/sys/netpfil/pf/ether.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh
index 975438dc3438..7a8b9e0d9b38 100644
--- a/tests/sys/netpfil/pf/ether.sh
+++ b/tests/sys/netpfil/pf/ether.sh
@@ -427,6 +427,13 @@ dummynet_body()
 
 	# 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
+
+	# We can now also dummynet outbound traffic!
+	pft_set_rules alcatraz \
+		"ether pass out dnpipe 1"
+
+	# We should still 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()