git: b476593519e9 - main - pfctl: check if the anchor exists before we attempt to flush anything from it
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Oct 2025 21:35:39 UTC
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);