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

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Tue May 29 23:40:32 UTC 2012


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


More information about the freebsd-current mailing list