From nobody Mon Apr 11 15:51:09 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 BB5E85D0743; Mon, 11 Apr 2022 15:51:09 +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 4KcYHK4d9gz3rn9; Mon, 11 Apr 2022 15:51:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649692269; 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=/LE7KtdswbWekPFVmln7bfM2YqOjEYdknzGhy1A31bw=; b=TSkwH/EqioAvuwbFVpli76Q+13u3AvS2Bzki5Fdd39Y57eo9Sbt9oOspkTfRaNMGGxqzhP c+TxSIcOcydUeehPRi4dlYjwY7JLyIfCMrY8pI/5Cz2RaFh/grYkbNiU5Zp8tdMsVwnCwP FN8YSDQTjHGDc+Apyt3nMKsx5bOxCFJpkrwMxmaUh9sv37SXuUs4LhWv6T4wmNzaQst48E zAsY7kh5QcyBdOkiXpMn4CnWasNiXnD/G18laEsq01is5geNHa53U0bRM+oLgrBcfDlWSC YAjvnWQ82f0kPQioQehZHoTnkgHhrdUqpOcPkblUsEefYAz/Ma5nbbxkAXCxdg== 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 7ECEF2596E; Mon, 11 Apr 2022 15:51:09 +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 23BFp9wQ003184; Mon, 11 Apr 2022 15:51:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23BFp9V7003183; Mon, 11 Apr 2022 15:51:09 GMT (envelope-from git) Date: Mon, 11 Apr 2022 15:51:09 GMT Message-Id: <202204111551.23BFp9V7003183@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: 4496aecb56e6 - main - pf: drain Ethernet rules cleanup before starting a new transaction 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: 4496aecb56e667ab11bbbb92e164d3277205bae6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649692269; 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=/LE7KtdswbWekPFVmln7bfM2YqOjEYdknzGhy1A31bw=; b=YA9VFRyptsjTfDNk4Sg7b5LyfNiZxyC82Zhaw7zU/camY6klTfEZV04ckg8KKiFx2UAB1L bs8oF88I+p7Q3jS7lOLMRVBnqzGSjJTYLUKGMxsxnNdr9YgEiRPUw7Fcx7yarR4D58wJon Zdl7WKjeiMQrEj9u+JZL+9+BkdQ1eZHGZ6Dh7KX6SSZAsJhcO9SQBDavD8UDWb6EVIz5T3 Y5r6yFfXoJpXuGmuILWviDThf6VtWcx+taeiAIxx8CnoQcI1IQqSLXiEFkkz/GWK0c8XoV PIQeHEej/kFmYd4n/TSiwMmZszxU5CP+ygKOzUL6nGEVX9exw5RHLsrVq4ikJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649692269; a=rsa-sha256; cv=none; b=RXiK4b72RX0PsKCWISOT6S9MvxVEng3zHGk9Tq4wvgTTCme/V2+4dROFNdRZxYOLYOeA1W Y1zTvlT55uCLLfnX+xQzVzq8NTgCP4Oq011Ms4tiT4o7Luh7PKgsCe9Q4iuYm4eKl2e/eu cEdtwPJbpW49npIuQhiNT0zIP5q8g3WIq+RRmvIi1aprGegPCO2GF4pkzDbz7G560Z+ZTf IhD+Adb5Xdls/oRMSPdVLWk5SwT39wZhCdYoRR5qpahjTrv7q3jI5YayycjLCKsy0aFvUa /ItNev5PqAT5pylWVLwbpZO7IrKFlHYgTyHkojKoffiSIOePDDjK/FC/plO5pg== 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=4496aecb56e667ab11bbbb92e164d3277205bae6 commit 4496aecb56e667ab11bbbb92e164d3277205bae6 Author: Kristof Provost AuthorDate: 2022-04-06 15:03:13 +0000 Commit: Kristof Provost CommitDate: 2022-04-11 13:47:57 +0000 pf: drain Ethernet rules cleanup before starting a new transaction Inactive Ethernet rules get cleaned by a net_epoch callback. This callback may still be pending when we try to start a new (pf rules) transaction, causing it to fail. This is especially likely to occur in scripted scenarios, such as the regression tests. Drain the epoch callbacks before starting a new transaction, ensuring we've had the opportunity to clean up the inactive rules. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34846 --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index a8f9261111db..52f11f57c068 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5089,6 +5089,8 @@ DIOCCHANGEADDR_error: free(ioes, M_TEMP); break; } + /* Ensure there's no more ethernet rules to clean up. */ + epoch_drain_callbacks(net_epoch_preempt); PF_RULES_WLOCK(); for (i = 0, ioe = ioes; i < io->size; i++, ioe++) { ioe->anchor[sizeof(ioe->anchor) - 1] = '\0';