From: Ruben Kerkhof Date: Sun, 2 Jul 2017 18:34:59 +0000 (+0200) Subject: tcpconns plugin: fix build on FreeBSD current X-Git-Tag: collectd-5.8.0~1^2~20 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=02a29964b4e67bb04c1419daedc8eacfafdf0a7c;p=collectd.git tcpconns plugin: fix build on FreeBSD current FreeBSD commit https://github.com/freebsd/freebsd/commit/3a5c9aaf2b2ea107bcaf0ba28b706238d92bdbbd hides inpcb and tcpcb from userland. Patch taken from FreeBSD ports tree, thanks glebius@. --- diff --git a/src/tcpconns.c b/src/tcpconns.c index f949d34e..7036d08b 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -745,9 +745,15 @@ static int conn_read(void) { for (in_ptr = (struct xinpgen *)(((char *)in_orig) + in_orig->xig_len); in_ptr->xig_len > sizeof(struct xinpgen); in_ptr = (struct xinpgen *)(((char *)in_ptr) + in_ptr->xig_len)) { +#if __FreeBSD_version >= 1200026 + struct xtcpcb *tp = (struct xtcpcb *)in_ptr; + struct xinpcb *inp = &tp->xt_inp; + struct xsocket *so = &inp->xi_socket; +#else struct tcpcb *tp = &((struct xtcpcb *)in_ptr)->xt_tp; struct inpcb *inp = &((struct xtcpcb *)in_ptr)->xt_inp; struct xsocket *so = &((struct xtcpcb *)in_ptr)->xt_socket; +#endif /* Ignore non-TCP sockets */ if (so->xso_protocol != IPPROTO_TCP)