From: Florian Forster Date: Sat, 24 Jan 2009 10:00:30 +0000 (+0100) Subject: tcpconns plugin: Fix an endianness problem under *BSD. X-Git-Tag: collectd-4.6.0~19^2~2^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3f786367e7dfe91efbc602ba31fe39d5192117ea;p=collectd.git tcpconns plugin: Fix an endianness problem under *BSD. The port numbers were assumed to be in the host's byte order, when in fact they are in network byte order (big endian). The patch adds `ntohs' where necessary to fix this problem. Resolves: #35 --- diff --git a/src/tcpconns.c b/src/tcpconns.c index 2e115922..ff663b80 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -506,7 +506,8 @@ static int conn_read (void) && ((inp->inp_vflag & INP_IPV6) == 0)) continue; - conn_handle_ports (inp->inp_lport, inp->inp_fport, tp->t_state); + conn_handle_ports (ntohs (inp->inp_lport), ntohs (inp->inp_fport), + tp->t_state); } /* for (in_ptr) */ in_orig = NULL;