diff options
author | 2020-01-16 01:02:20 +0000 | |
---|---|---|
committer | 2020-01-16 01:02:20 +0000 | |
commit | ad846651a1e57f4044de08e014c62f6c17306af2 (patch) | |
tree | abe0ac1a7454bd725166f0eca4ca05c263cfcc65 | |
parent | Add multiple altname fields and test for different subjectAltName formats (diff) | |
download | wireguard-openbsd-ad846651a1e57f4044de08e014c62f6c17306af2.tar.xz wireguard-openbsd-ad846651a1e57f4044de08e014c62f6c17306af2.zip |
Fail on missing anchor
There is no reason to continue on anchor specific paths if the given
anchor does not exist.
OK sashan
-rw-r--r-- | sbin/pfctl/pfctl.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 5e00c7c4dae..e01087586c7 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.381 2020/01/15 22:38:31 kn Exp $ */ +/* $OpenBSD: pfctl.c,v 1.382 2020/01/16 01:02:20 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -967,13 +967,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, memset(&prs, 0, sizeof(prs)); memcpy(prs.path, npath, sizeof(prs.path)); - if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) { - if (errno == EINVAL) - fprintf(stderr, "Anchor '%s' " - "not found.\n", anchorname); - else - err(1, "DIOCGETRULESETS"); - } + if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) + errx(1, "%s", pf_strerror(errno)); mnr = prs.nr; for (nr = 0; nr < mnr; ++nr) { @@ -2206,13 +2201,8 @@ pfctl_walk_anchors(int dev, int opts, const char *anchor, memset(&pr, 0, sizeof(pr)); strlcpy(pr.path, anchor, sizeof(pr.path)); - if (ioctl(dev, DIOCGETRULESETS, &pr) == -1) { - if (errno == EINVAL) - fprintf(stderr, "Anchor '%s' not found.\n", anchor); - else - err(1, "DIOCGETRULESETS"); - return (-1); - } + if (ioctl(dev, DIOCGETRULESETS, &pr) == -1) + errx(1, "%s", pf_strerror(errno)); mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { char sub[PATH_MAX]; |