bsnmp: Use libpfctl

Reviewed by:	glebius
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29642
This commit is contained in:
Kristof Provost 2021-03-29 17:43:25 +02:00
parent 95be9288f0
commit 956e7d2325
2 changed files with 6 additions and 1 deletions

View File

@ -9,4 +9,7 @@ XSYM= begemotPf
DEFS= ${MOD}_tree.def
BMIBS= BEGEMOT-PF-MIB.txt
CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl
LIBADD+= pfctl
.include <bsd.snmpmod.mk>

View File

@ -38,6 +38,7 @@
#include <errno.h>
#include <fcntl.h>
#include <libpfctl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -1528,7 +1529,8 @@ pfl_scan_ruleset(const char *path)
for (nr = pr.nr, i = 0; i < nr; i++) {
pr.nr = i;
if (ioctl(dev, DIOCGETRULE, &pr)) {
if (pfctl_add_rule(dev, &pr.rule, pr.anchor, pr.anchor_call,
pr.ticket, pr.pool_ticket)) {
syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULE):"
" %s", strerror(errno));
goto err;