From nobody Mon Oct 31 17:14:28 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 4N1KWm6Ft4z4gkSR; Mon, 31 Oct 2022 17:14:28 +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 4N1KWm5Sl4z3hPy; Mon, 31 Oct 2022 17:14:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667236468; 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=64KZM8mq2nPMKUXAQOUY+NVonyJk3tQCpt9YazUBUmw=; b=inxKJhgu+Da4OTrEeyrch/SP20NlXkTIFgaZwNBbowdwDka1mCGUpYJGixSJfVsOsq8f3c 1Aw55YDvrzhyEkgKNWRSI1+8ZQdz+/Yk5nUaNlZiZyfoZcvp6KORU6dfKW8Wa8rZPS7gyV i+d7/piCn5jIhv0sznZekZSVfP0vGF5TBfhEOn0vs2v7Dipqzcx3xb+PY8e/RdXdetl2Nm DWUWsBif4CzStFHXzMBeckoEIdpO37dgNSwSZOGPbwR1C7YYnh9RB9xDgMrp6+CvKxTtwK QpUgBZFFUZfkGtRryjO4XxF0VP/rkAWVwhNTXhGPu5NV7VSpviPKmTXhpW+I0Q== 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 4N1KWm4Z1LzkdH; Mon, 31 Oct 2022 17:14:28 +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 29VHESxp003275; Mon, 31 Oct 2022 17:14:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29VHESSU003274; Mon, 31 Oct 2022 17:14:28 GMT (envelope-from git) Date: Mon, 31 Oct 2022 17:14:28 GMT Message-Id: <202210311714.29VHESSU003274@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: b0bf4303109a - main - 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/main X-Git-Reftype: branch X-Git-Commit: b0bf4303109a76eb4224015b9abebf88e96116ef Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667236468; 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=64KZM8mq2nPMKUXAQOUY+NVonyJk3tQCpt9YazUBUmw=; b=OA2un55865hrzT/1ta6SDvZTo7RhS1qSjTHS4hN6hz6bgscJfltb5gEsfKi0dKk+aNgApO Og3/tjOFJv763uOCFzRItmkxRTLyxmHepgDYIQRg1ig2QIi/h1ljjUmtiZLe4HIRtUvNdz 8/hQn+f93vTwpedySB/JeT5yD3tWT1nbcNfuR9qgavMpzgWZOFhYOcGnFfBiHgpQgmEpsN 5pN3Qikd6NRE6FX2UC0ks4wRXfSYWD8n6cyxTfaEkGgFS8gdQjtAg1qR1K4mgXo2nEAI7s shksHrbVjmJdmq+ASOJaC8g4SNpxe0zNs01wdyT+zsnxclKS1VEAzAUhSR9tKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667236468; a=rsa-sha256; cv=none; b=pIy2LzZWXp/tswpiR7RzNfY7+kd9yCEPlb+vplzJyLjJ1lwV/TAvLxUOvJFt7HSoWxaSK+ 9wCvNaENs2MNzN2aeW/1g9Ni0k3IULtZXtnQb+Fv240uY4VIjKfkJfXorIE1Q7eD7S3gQK c4v/rBSelsoIv8t7X9DEgRW4xNrCbcG56JHVbsKfJiQRkeBO+JfmpNZE9iCk8L5gyJOEFI 95Qsc3QdarDLwsih/ULqcV/8iqNx378HF4I2orrLwjUncWV1swuNqOUVgnIFG5sdjFU2HN Ekaq2nZB3YwWuPI0FTjRHYu544r63qWgsfy/XWN5xVpbjaChfPeh4wUOLERDOA== 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=b0bf4303109a76eb4224015b9abebf88e96116ef commit b0bf4303109a76eb4224015b9abebf88e96116ef Author: Kristof Provost AuthorDate: 2022-10-31 11:15:58 +0000 Commit: Kristof Provost CommitDate: 2022-10-31 17:14:10 +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") --- 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 36d80b82289b..9ef20fad4554 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -29,6 +29,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() { @@ -63,6 +71,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() @@ -196,12 +212,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)