[patch] rfc: bsnmpd does not count ipv6 tcp connections in tcpCurrEstab

From: Maksim Yevmenkin <maksim.yevmenkin_at_gmail.com>
Date: Tue, 29 May 2012 16:40:26 -0700
hello,

any objections to the following patch?

===

Index: mibII_tcp.c
===================================================================
--- mibII_tcp.c	(revision 236265)
+++ mibII_tcp.c	(working copy)
_at__at_ -109,10 +109,12 _at__at_
              ptr = (struct xinpgen *)(void *)((char *)ptr + ptr->xig_len)) {
 		tp = (struct xtcpcb *)ptr;
 		if (tp->xt_inp.inp_gencnt > xinpgen->xig_gen ||
-		    (tp->xt_inp.inp_vflag & INP_IPV4) == 0)
+		    (tp->xt_inp.inp_vflag & (INP_IPV4|INP_IPV6)) == 0)
 			continue;

-		tcp_total++;
+		if (tp->xt_inp.inp_vflag & INP_IPV4)
+			tcp_total++;
+
 		if (tp->xt_tp.t_state == TCPS_ESTABLISHED ||
 		    tp->xt_tp.t_state == TCPS_CLOSE_WAIT)
 			tcp_count++;

===

the idea is to return proper number of tcp connections (for both ipv4
and ipv6) in tcpCurrEstab. tcpConnTable will still return only ipv4
entries.

thanks,
max
Received on Tue May 29 2012 - 21:40:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:27 UTC