Skip to content

Commit b476593

Browse files
committed
pfctl: check if the anchor exists before we attempt to flush anything from it
PR: 289994 Sponsored by: Rubicon Communications, LLC ("Netgate")
1 parent 8fecb09 commit b476593

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sbin/pfctl/pfctl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,6 +3585,12 @@ main(int argc, char *argv[])
35853585
}
35863586

35873587
if (clearopt != NULL) {
3588+
int mnr;
3589+
3590+
/* Check if anchor exists. */
3591+
if ((pfctl_get_rulesets(pfh, anchorname, &mnr)) == ENOENT)
3592+
errx(1, "No such anchor %s", anchorname);
3593+
35883594
switch (*clearopt) {
35893595
case 'e':
35903596
pfctl_flush_eth_rules(dev, opts, anchorname);

0 commit comments

Comments
 (0)