aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2026-05-05 16:57:25 +0000
committerKristof Provost <kp@FreeBSD.org>2026-05-05 20:20:42 +0000
commitc24b1d9359b899c7532d5b296f37cf3d74a36942 (patch)
treeeeca06811fab29617343c0337ba5d2af930d0702
parenta0e4c65f1814a7a677364dc29bb703f84323d175 (diff)
pfctl: handle errors from PFNL_CMD_GETSTATES
Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r--lib/libpfctl/libpfctl.c2
-rw-r--r--sbin/pfctl/pfctl.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 59783592a370..ac60a924c228 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2009,7 +2009,7 @@ pfctl_get_states_h(struct pfctl_handle *h, struct pfctl_state_filter *filter, pf
return (ret);
}
- return (0);
+ return (e.error);
}
int
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index e84e7f9272d4..f35baf25ec35 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1991,6 +1991,7 @@ pfctl_show_states(int dev, const char *iface, int opts)
{
struct pfctl_show_state_arg arg;
struct pfctl_state_filter filter = {};
+ int ret;
if (iface != NULL)
strlcpy(filter.ifname, iface, IFNAMSIZ);
@@ -1999,8 +2000,8 @@ pfctl_show_states(int dev, const char *iface, int opts)
arg.dotitle = opts & PF_OPT_SHOWALL;
arg.iface = iface;
- if (pfctl_get_states_h(pfh, &filter, pfctl_show_state, &arg))
- return (-1);
+ if ((ret = pfctl_get_states_h(pfh, &filter, pfctl_show_state, &arg)) != 0)
+ errc(1, ret, "pfctl_get_states");
return (0);
}