From 02a29964b4e67bb04c1419daedc8eacfafdf0a7c Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 2 Jul 2017 20:34:59 +0200 Subject: [PATCH] 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@. --- src/tcpconns.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.30.2