From nobody Mon Aug 28 12:03:19 2023 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 4RZ8Mq3kCMz4rTVJ; Mon, 28 Aug 2023 12:03:19 +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 4RZ8Mq381Vz3dBM; Mon, 28 Aug 2023 12:03:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693224199; 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=j1u93JvXuo11Ayvag6q5pX+WtUytmpopAVLXUELewnc=; b=R8Q9oURCbGBIxtYHcEvfCAzm9wPi6+/5Mr+vqLUN9+U9Tivv9BnRGq7zK8xZqo1zeDAvOC K4CVfHNOzwGW5h3annqDkzbLB5MXWMbKMnyLuZ8kjKeQM6NIUKe1kRKb2hQySuZMVLTeBm XvKmFKegzxSH+baZdNP5Nl/BwqURgp0zoQwcOaK1n0+4/afXC2jS3fuxhDufwF2bqY8+CZ 2xsSUQbZGvAwwHr5kkNSfKDnhb4jCv8jl/RV9Qx7ZG8/C1zStlXFn1daxIoKY4k6bRWmrH Qq/mPO7dbPW525sUEUptwBMuR07jspNY06fizljq81grgBfL6XxAAs7+DCf9oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693224199; 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=j1u93JvXuo11Ayvag6q5pX+WtUytmpopAVLXUELewnc=; b=TO4O+LHvBANcpCrIkKoEijUTkqOnKUVU9/RiDPyN7LPce72eYf1xeD5BDBeVG1TW7iS0GL qXZsQspz3KXtSY1xk4sjVG/nMxf1hlsgK2bo9S41jOSawhxJakcG1d8MJns7teNWY/EnyR 8QNLJmg/MLKCGYwTAPsUoj6Y65zO0qsJYJG8iQ/Ivbr5juWD+Rf4dpKIxVzPJJlVMEIJf+ KKOPWGbErb7qZVGMU13OeH6RzeQz1LIebiSCU7AaccK7PALZaqbSXkvmFxBRi3oDLOIwlQ E2TyThWezyL8+l8IimT/3iFPBPSIALN3X5EXMKFouqX+rVcEmWReah1rFIGDAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693224199; a=rsa-sha256; cv=none; b=Zkm52FXAbz6O/6EcZwwr+qkSSx9qpxot7jzlsLzdOTyTiZpK8ts+qIAU74WWZw+2xQmc+X MTYYwAocmAfkrny2LugB+a0nNeZ3EqWPiEcPfqF4ZlD+Bw+bljb4sYeGEVCTTwWkV5WzTW pCX8Q/RB5Dpq5idhWc0SlxaR5roUPCahJy+w5sY9qJjuKLY92HbJ417F3HqtmxfvlmbjKS 353riCYPcvZCykl1n7C67LHmWrgD61LAWj8i0ACvKZtCxAMZWsrA8UJoTbc2eGV8Mil9A/ guDwehjBPJVOA4vjFcDxrYvGRqBgKxXZfewceaq2v5PzZZEaGZVOkwiuK1ZpIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RZ8Mq2CQkz16vr; Mon, 28 Aug 2023 12:03:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37SC3J5s030390; Mon, 28 Aug 2023 12:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37SC3J7H030387; Mon, 28 Aug 2023 12:03:19 GMT (envelope-from git) Date: Mon, 28 Aug 2023 12:03:19 GMT Message-Id: <202308281203.37SC3J7H030387@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: b1b8f5a15fc0 - stable/13 - pf tests: verify syncookie status report 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b1b8f5a15fc0fde1aea5eea5d1ecb7cfbee89d19 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b1b8f5a15fc0fde1aea5eea5d1ecb7cfbee89d19 commit b1b8f5a15fc0fde1aea5eea5d1ecb7cfbee89d19 Author: Kristof Provost AuthorDate: 2022-10-31 11:15:58 +0000 Commit: Kristof Provost CommitDate: 2023-08-28 08:17:18 +0000 pf tests: verify syncookie status report Verify that pfctl -si -v correctly shows syncookies to be active/inactive. Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit b0bf4303109a76eb4224015b9abebf88e96116ef) --- tests/sys/netpfil/pf/syncookie.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index eb9f8c737476..290b61817471 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -28,6 +28,14 @@ common_dir=$(atf_get_srcdir)/../common +syncookie_state() +{ + jail=$1 + + jexec $jail pfctl -si -v | grep -A 2 '^Syncookies' | grep active \ + | awk '{ print($2); }' +} + atf_test_case "basic" "cleanup" basic_head() { @@ -62,6 +70,14 @@ basic_body() then atf_fail "Failed to connect to syncookie protected echo daemon" fi + + + # Check that status shows syncookies as being active + active=$(syncookie_state alcatraz) + if [ "$active" != "active" ]; + then + atf_fail "syncookies not active" + fi } basic_cleanup() @@ -195,12 +211,26 @@ adaptive_body() # Sanity check atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + # Check that status shows syncookies as being inactive + active=$(syncookie_state alcatraz) + if [ "$active" != "inactive" ]; + then + atf_fail "syncookies active when they should not be" + fi + # Now syn flood to create many states ${common_dir}/pft_synflood.py \ --sendif ${epair}a \ --to 192.0.2.2 \ --count 100 + # Check that status shows syncookies as being active + active=$(syncookie_state alcatraz) + if [ "$active" != "active" ]; + then + atf_fail "syncookies not active" + fi + # Adaptive mode should kick in and stop us from creating more than # about 10 states states=$(jexec alcatraz pfctl -ss | grep tcp | wc -l)