diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2025-12-29 09:45:48 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2025-12-30 13:16:52 +0000 |
| commit | c2e7a52374b3e4bef41c5cad4c24f158c870b476 (patch) | |
| tree | 0c8f0fe6de27cd616ac579cb9ffb498c43352716 /lib | |
| parent | 190c1f3d9326afbc1eabd48e5cb3fe96043508c9 (diff) | |
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libpfctl/libpfctl.c | 25 | ||||
| -rw-r--r-- | lib/libpfctl/libpfctl.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7e5a07ccd55a..6aac9a9c04ae 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -3843,3 +3843,28 @@ pfctl_get_astats(struct pfctl_handle *h, const struct pfr_table *tbl, return (0); } + +int +pfctl_clr_astats(struct pfctl_handle *h, const struct pfr_table *tbl, + struct pfr_addr *addr, int size, int *nzero, int flags) +{ + struct pfioc_table io; + + if (size < 0 || !tbl || (size && !addr)) { + errno = EINVAL; + return (-1); + } + + bzero(&io, sizeof io); + io.pfrio_flags = flags; + io.pfrio_table = *tbl; + io.pfrio_buffer = addr; + io.pfrio_esize = sizeof(*addr); + io.pfrio_size = size; + if (ioctl(h->fd, DIOCRCLRASTATS, &io) == -1) + return (-1); + if (nzero) + *nzero = io.pfrio_nzero; + return (0); +} + diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 9576118fe146..b885497ab0e8 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -587,5 +587,7 @@ int pfctl_clear_addrs(struct pfctl_handle *h, const struct pfr_table *filter, int pfctl_get_astats(struct pfctl_handle *h, const struct pfr_table *tbl, struct pfr_astats *addr, int *size, int flags); +int pfctl_clr_astats(struct pfctl_handle *h, const struct pfr_table *tbl, + struct pfr_addr *addr, int size, int *nzero, int flags); #endif |
