From owner-dev-commits-src-branches@freebsd.org Mon Jun 7 15:43:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56B5264FEA6; Mon, 7 Jun 2021 15:43:08 +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 4FzHhD1v8pz3Mwk; Mon, 7 Jun 2021 15:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1CE0A18601; Mon, 7 Jun 2021 15:43:08 +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 157Fh7xB037306; Mon, 7 Jun 2021 15:43:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 157Fh7W9037305; Mon, 7 Jun 2021 15:43:07 GMT (envelope-from git) Date: Mon, 7 Jun 2021 15:43:07 GMT Message-Id: <202106071543.157Fh7W9037305@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: dedd9ee84bb0 - stable/13 - pf tests: Make killstate:match more robust 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: dedd9ee84bb0a93d0afc3c1df4a8bf4e7e8b85c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 15:43:08 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dedd9ee84bb0a93d0afc3c1df4a8bf4e7e8b85c7 commit dedd9ee84bb0a93d0afc3c1df4a8bf4e7e8b85c7 Author: Kristof Provost AuthorDate: 2021-06-03 13:22:19 +0000 Commit: Kristof Provost CommitDate: 2021-06-07 15:42:19 +0000 pf tests: Make killstate:match more robust The killstate:match test starts nc as a background process. There was no guarantee that the nc process would have connected by the time we check for states, so this test occasionally failed without good reason. Teach the test to wait for at least some states to turn up before executing the critical checks. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 70dd30d49c29a27e1ef159660a7e3dbb84082674) --- tests/sys/netpfil/pf/killstate.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index b3d94a245548..f53ede8c7578 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -384,6 +384,17 @@ match_head() atf_set require.user root } +wait_for_state() +{ + jail=$1 + addr=$2 + + while ! jexec $jail pfctl -s s | grep $addr >/dev/null; + do + sleep .1 + done +} + match_body() { pft_init @@ -412,6 +423,7 @@ match_body() "pass all" nc 198.51.100.2 7 & + wait_for_state alcatraz 192.0.2.1 # Expect two states states=$(jexec alcatraz pfctl -s s | wc -l) @@ -432,6 +444,7 @@ match_body() jexec alcatraz pfctl -F states nc 198.51.100.2 7 & + wait_for_state alcatraz 192.0.2.1 # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1