FreeBSD Bugzilla – Attachment 246235 Details for
Bug 275013
net-mgmt/collectd5: Add libpfctl dep to fix build on main
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
collectd-libpfctl.diff (text/plain), 3.79 KB, created by
Brad Davis
on 2023-11-10 14:59:48 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Brad Davis
Created:
2023-11-10 14:59:48 UTC
Size:
3.79 KB
patch
obsolete
>commit cbc625eef6b7689e40d6cd308f5f93a47eefb8a2 >Author: Brad Davis <brd@FreeBSD.org> >Date: Fri Nov 10 07:57:08 2023 -0700 > > net-mgmt/collectd5: Add libpfctl support to fix build on main > >diff --git a/net-mgmt/collectd5/Makefile b/net-mgmt/collectd5/Makefile >index 049f6fdebb..441f720d49 100644 >--- a/net-mgmt/collectd5/Makefile >+++ b/net-mgmt/collectd5/Makefile >@@ -1,6 +1,6 @@ > PORTNAME= collectd > PORTVERSION= 5.12.0 >-PORTREVISION= 9 >+PORTREVISION= 10 > CATEGORIES= net-mgmt > MASTER_SITES= https://storage.googleapis.com/collectd-tarballs/ > PKGNAMESUFFIX= 5 >@@ -12,7 +12,10 @@ WWW= https://www.collectd.org/ > LICENSE= GPLv2 > LICENSE_FILE= ${WRKSRC}/COPYING > >-USES= autoreconf cpe gmake libtool pkgconfig shebangfix tar:bzip2 >+LIB_DEPENDS= libpfctl.so:net/libpfctl >+LDFLAGS+= -lpfctl >+ >+USES= autoreconf cpe gmake libtool localbase:ldflags pkgconfig shebangfix tar:bzip2 > > GNU_CONFIGURE= yes > >diff --git a/net-mgmt/collectd5/files/patch-src_pf.c b/net-mgmt/collectd5/files/patch-src_pf.c >new file mode 100644 >index 0000000000..a4027f47b4 >--- /dev/null >+++ b/net-mgmt/collectd5/files/patch-src_pf.c >@@ -0,0 +1,105 @@ >+--- src/pf.c.orig 2020-07-20 09:50:14 UTC >++++ src/pf.c >+@@ -35,6 +35,9 @@ >+ #endif >+ >+ #include <net/pfvar.h> >++#ifdef __FreeBSD__ >++#include <libpfctl.h> >++#endif >+ >+ #ifndef FCNT_NAMES >+ #if FCNT_MAX != 3 >+@@ -77,9 +80,12 @@ static int pf_read(void) { >+ } /* void pf_submit */ >+ >+ static int pf_read(void) { >++#ifdef __FreeBSD__ >++ struct pfctl_status *state; >++#else >+ struct pf_status state; >++#endif >+ int fd; >+- int status; >+ >+ fd = open(pf_device, O_RDONLY); >+ if (fd < 0) { >+@@ -87,8 +93,11 @@ static int pf_read(void) { >+ return -1; >+ } >+ >+- status = ioctl(fd, DIOCGETSTATUS, &state); >+- if (status != 0) { >++#ifdef __FreeBSD__ >++ if ((state = pfctl_get_status(fd)) == NULL) { >++#else >++ if (ioctl(fd, DIOCGETSTATUS, &state) != 0) { >++#endif >+ ERROR("pf plugin: ioctl(DIOCGETSTATUS) failed: %s", STRERRNO); >+ close(fd); >+ return -1; >+@@ -96,26 +105,58 @@ static int pf_read(void) { >+ >+ close(fd); >+ >+- if (!state.running) { >++ if (!state->running) { >++#ifdef __FreeBSD__ >++ pfctl_free_status(state); >++#endif >+ WARNING("pf plugin: PF is not running."); >+ return -1; >+ } >+ >+ for (int i = 0; i < PFRES_MAX; i++) >+- pf_submit("pf_counters", pf_reasons[i], state.counters[i], >++ pf_submit("pf_counters", pf_reasons[i], >++#ifdef __FreeBSD__ >++ pfctl_status_counter(state, i), >++#else >++ state.counters[i], >++#endif >+ /* is gauge = */ false); >+ for (int i = 0; i < LCNT_MAX; i++) >+- pf_submit("pf_limits", pf_lcounters[i], state.lcounters[i], >++ pf_submit("pf_limits", pf_lcounters[i], >++#ifdef __FreeBSD__ >++ pfctl_status_lcounter(state, i), >++#else >++ state.lcounters[i], >++#endif >+ /* is gauge = */ false); >+ for (int i = 0; i < FCNT_MAX; i++) >+- pf_submit("pf_state", pf_fcounters[i], state.fcounters[i], >++ pf_submit("pf_state", pf_fcounters[i], >++#ifdef __FreeBSD__ >++ pfctl_status_fcounter(state, i), >++#else >++ state.fcounters[i], >++#endif >+ /* is gauge = */ false); >+ for (int i = 0; i < SCNT_MAX; i++) >+- pf_submit("pf_source", pf_scounters[i], state.scounters[i], >++ pf_submit("pf_source", pf_scounters[i], >++#ifdef __FreeBSD__ >++ pfctl_status_scounter(state, i), >++#else >++ state.scounters[i], >++#endif >+ /* is gauge = */ false); >+ >+- pf_submit("pf_states", "current", (uint32_t)state.states, >++ pf_submit("pf_states", "current", >++#ifdef __FreeBSD__ >++ (uint32_t)state->states, >++#else >++ (uint32_t)state.states, >++#endif >+ /* is gauge = */ true); >++ >++#ifdef __FreeBSD__ >++ pfctl_free_status(state); >++#endif >+ >+ return 0; >+ } /* int pf_read */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 275013
:
246235
|
246615