summaryrefslogtreecommitdiff
path: root/sysutils/pfstat
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/pfstat')
-rw-r--r--sysutils/pfstat/Makefile24
-rw-r--r--sysutils/pfstat/files/patch-pf.c50
2 files changed, 61 insertions, 13 deletions
diff --git a/sysutils/pfstat/Makefile b/sysutils/pfstat/Makefile
index a89e00609971..7062f41a81f8 100644
--- a/sysutils/pfstat/Makefile
+++ b/sysutils/pfstat/Makefile
@@ -1,23 +1,24 @@
PORTNAME= pfstat
-PORTVERSION= 2.5
-PORTREVISION= 8
+DISTVERSION= 2.5
+PORTREVISION= 9
CATEGORIES= sysutils net
MASTER_SITES= https://www.benzedrine.ch/
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= rootnode+freebsd@wollwage.com
COMMENT= Utility to render graphical statistics for pf
WWW= https://www.benzedrine.ch/pfstat.html
LICENSE= BSD2CLAUSE
LIB_DEPENDS= libgd.so:graphics/gd \
+ libpfctl.so:net/libpfctl \
libpng.so:graphics/png
-USES= iconv jpeg
-
+USES= iconv jpeg localbase:ldflags
USE_RC_SUBR= pfstatd
-MAKE_ARGS= "LD_GD=gd"
+CFLAGS+= -I/usr/include/net
+LDFLAGS+= -lpfctl
PLIST_FILES= bin/pfstat \
bin/pfstatd \
@@ -25,16 +26,13 @@ PLIST_FILES= bin/pfstat \
share/man/man8/pfstatd.8.gz
post-patch:
- @${REINPLACE_CMD} -e 's|-lgd|-l$${LD_GD}|; s| -lttf||' \
- ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e "s|/etc/|${PREFIX}/etc/|" \
${WRKSRC}/pfstat.[c8]
- @${REINPLACE_CMD} 's|altq/|net/&|' ${WRKSRC}/pf.c
do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/pfstat ${STAGEDIR}/${PREFIX}/bin
- ${INSTALL_PROGRAM} ${WRKSRC}/pfstatd/pfstatd ${STAGEDIR}/${PREFIX}/bin
- ${INSTALL_MAN} ${WRKSRC}/pfstat.8 ${STAGEDIR}/${PREFIX}/share/man/man8
- ${INSTALL_MAN} ${WRKSRC}/pfstatd/pfstatd.8 ${STAGEDIR}/${PREFIX}/share/man/man8
+ ${INSTALL_PROGRAM} ${WRKSRC}/pfstat \
+ ${WRKSRC}/pfstatd/pfstatd ${STAGEDIR}/${PREFIX}/bin
+ ${INSTALL_MAN} ${WRKSRC}/pfstat.8 \
+ ${WRKSRC}/pfstatd/pfstatd.8 ${STAGEDIR}/${PREFIX}/share/man/man8
.include <bsd.port.mk>
diff --git a/sysutils/pfstat/files/patch-pf.c b/sysutils/pfstat/files/patch-pf.c
new file mode 100644
index 000000000000..a5ee52b7b909
--- /dev/null
+++ b/sysutils/pfstat/files/patch-pf.c
@@ -0,0 +1,50 @@
+--- pf.c.orig 2007-01-11 16:01:58 UTC
++++ pf.c
+@@ -46,6 +46,7 @@ static const char rcsid[] = "$Id: pf.c,v 1.1.1.1 2007/
+ #include <err.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <libpfctl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -167,20 +168,29 @@ query_counters(int fd, void (*cb)(int, const char *, i
+ static int
+ query_counters(int fd, void (*cb)(int, const char *, int, double))
+ {
+- struct pf_status s;
+- int i;
++ struct pfctl_status *s;
++ struct pfctl_status_counter *np;
+
+- memset(&s, 0, sizeof(s));
+- if (ioctl(fd, DIOCGETSTATUS, &s)) {
+- fprintf(stderr, "ioctl: DIOCGETSTATUS: %s\n", strerror(errno));
++ s = pfctl_get_status(fd);
++ if (s == NULL) {
++ fputs("pfctl_get_status failure.\n",stderr);
+ return (1);
+ }
+- (*cb)(COL_TYPE_SINCE, "", 0, s.since);
+- (*cb)(COL_TYPE_GLOBAL, "", 0, s.states);
+- for (i = 0; i < FCNT_MAX; ++i)
+- (*cb)(COL_TYPE_GLOBAL, "", 1 + i, s.fcounters[i]);
+- for (i = 0; i < PFRES_MAX; ++i)
+- (*cb)(COL_TYPE_GLOBAL, "", 1 + FCNT_MAX + i, s.counters[i]);
++
++ (*cb)(COL_TYPE_SINCE, "", 0, s->since);
++ (*cb)(COL_TYPE_GLOBAL, "", 0, s->states);
++
++ TAILQ_FOREACH(np, &s->fcounters, entry) {
++ if (np->id < FCNT_MAX)
++ (*cb)(COL_TYPE_GLOBAL, "", 1 + np->id, np->counter);
++ }
++
++ TAILQ_FOREACH(np, &s->counters, entry) {
++ if (np->id < PFRES_MAX)
++ (*cb)(COL_TYPE_GLOBAL, "", 1 + FCNT_MAX + np->id, np->counter);
++ }
++
++ pfctl_free_status(s);
+ return (0);
+ }