aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/pfctl/pfctl.c6
1 files changed, 6 insertions, 0 deletions
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);