Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2025 21:35:39 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b476593519e9 - main - pfctl: check if the anchor exists before we attempt to flush anything from it
Message-ID:  <202510062135.596LZd5U045328@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

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

commit b476593519e98c11752a207e7cb121fba5c1961b
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-10-06 15:57:44 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-10-06 21:35:30 +0000

    pfctl: check if the anchor exists before we attempt to flush anything from it
    
    PR:             289994
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/pfctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 998148f5e75f..ed317495c2e0 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -3585,6 +3585,12 @@ main(int argc, char *argv[])
 	}
 
 	if (clearopt != NULL) {
+		int	 mnr;
+
+		/* Check if anchor exists. */
+		if ((pfctl_get_rulesets(pfh, anchorname, &mnr)) == ENOENT)
+			errx(1, "No such anchor %s", anchorname);
+
 		switch (*clearopt) {
 		case 'e':
 			pfctl_flush_eth_rules(dev, opts, anchorname);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510062135.596LZd5U045328>