Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2012 16:40:26 -0700
From:      Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
To:        current@freebsd.org
Cc:        syrinx@freebsd.org
Subject:   [patch] rfc: bsnmpd does not count ipv6 tcp connections in tcpCurrEstab
Message-ID:  <CAFPOs6pvkYANV=KF7ZEPmSBXkNTR4JzcL6H_cssPXEE5B7uBBw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
hello,

any objections to the following patch?

===

Index: mibII_tcp.c
===================================================================
--- mibII_tcp.c	(revision 236265)
+++ mibII_tcp.c	(working copy)
@@ -109,10 +109,12 @@
              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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFPOs6pvkYANV=KF7ZEPmSBXkNTR4JzcL6H_cssPXEE5B7uBBw>