diff options
author | Kristof Provost <kp@FreeBSD.org> | 2023-10-16 14:47:22 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2023-10-23 14:24:52 +0000 |
commit | 044eef6ab9cf1730d21c5f5dffebb0cd35fb5bbf (patch) | |
tree | eec05869ef1d10146677579d434ad8a86adc34b9 /sbin/pfctl | |
parent | ffbf25951e7b7f867989b621b2c07e9dad9441fb (diff) | |
download | src-044eef6ab9cf1730d21c5f5dffebb0cd35fb5bbf.tar.gz src-044eef6ab9cf1730d21c5f5dffebb0cd35fb5bbf.zip |
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/pfctl.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 56b1d28c6fd6..c3f3d82ff767 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1529,9 +1529,6 @@ pfctl_show_state(struct pfctl_state *s, void *arg) { struct pfctl_show_state_arg *a = (struct pfctl_show_state_arg *)arg; - if (a->iface != NULL && strcmp(s->ifname, a->iface)) - return (0); - if (a->dotitle) { pfctl_print_title("STATES:"); a->dotitle = 0; @@ -1545,12 +1542,16 @@ int pfctl_show_states(int dev, const char *iface, int opts) { struct pfctl_show_state_arg arg; + struct pfctl_state_filter filter = {}; + + if (iface != NULL) + strncpy(filter.ifname, iface, IFNAMSIZ); arg.opts = opts; arg.dotitle = opts & PF_OPT_SHOWALL; arg.iface = iface; - if (pfctl_get_states_iter(pfctl_show_state, &arg)) + if (pfctl_get_filtered_states_iter(&filter, pfctl_show_state, &arg)) return (-1); return (0); |