From kstailey@hermes.tubas.net  Tue Apr 13 05:16:17 2004
Return-Path: <kstailey@hermes.tubas.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id D9D3416A4CE; Tue, 13 Apr 2004 05:16:17 -0700 (PDT)
Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 826E343D1F; Tue, 13 Apr 2004 05:16:17 -0700 (PDT)
	(envelope-from kstailey@hermes.tubas.net)
Received: from hermes.tubas.net ([69.138.247.249])
          by comcast.net (rwcrmhc12) with ESMTP
          id <20040413121616014001e031e>; Tue, 13 Apr 2004 12:16:17 +0000
Received: from hermes.trickster.gods (localhost.trickster.gods [127.0.0.1])
	by hermes.tubas.net (8.12.11/8.12.11) with ESMTP id i3DCGFn1044416;
	Tue, 13 Apr 2004 08:16:15 -0400 (EDT)
	(envelope-from kstailey@hermes.trickster.gods)
Received: (from kstailey@localhost)
	by hermes.trickster.gods (8.12.11/8.12.11/Submit) id i3DCGFfb044409;
	Tue, 13 Apr 2004 08:16:15 -0400 (EDT)
	(envelope-from kstailey)
Message-Id: <200404131216.i3DCGFfb044409@hermes.trickster.gods>
Date: Tue, 13 Apr 2004 08:16:15 -0400 (EDT)
From: Ken Stailey <kstailey@yahoo.com>
Reply-To: Ken Stailey <kstailey@yahoo.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: kuriyama@freebsd.org
Subject: net-snmp no longer sets tcp.tcpCurrEstab.0
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         65487
>Category:       ports
>Synopsis:       net-snmp no longer sets tcp.tcpCurrEstab.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kuriyama
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 13 05:20:18 PDT 2004
>Closed-Date:    Tue Apr 13 17:58:12 PDT 2004
>Last-Modified:  Tue Apr 13 17:58:12 PDT 2004
>Originator:     Ken Stailey
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
self
>Environment:
System: FreeBSD hermes.trickster.gods 4.9-STABLE FreeBSD 4.9-STABLE #54: Thu Mar 25 10:46:59 EST 2004 kstailey@hermes.trickster.gods:/usr/obj/usr/src/sys/HERMES i386


	
>Description:

The mib element tcp.tcpCurrEstab.0 was not working, then it got fixed but
it's broken again.

>How-To-Repeat:

http://www.freshports.org/phorum/read.php?f=2&i=157&t=157

>Fix:

I think the Makefile needs to set --with-modules=mibII/tcpTable
so that in
ports/net-mgmt/net-snmp/work/net-snmp-5.1.1/agent/mibgroup/mibII/tcp.c
USING_MIBII_TCPTABLE_MODULE will be set and the code

 case TCPCURRESTAB:
#ifdef USING_MIBII_TCPTABLE_MODULE
ret_value = TCP_Count_Connections();
#else
ret_value = 0;
#endif

will be a call to TCP_Count_Connections() which will fill the mib element
tcp.tcpCurrEstab.0

>Release-Note:
>Audit-Trail:

From: Kenneth Stailey <kstailey@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kuriyama@FreeBSD.org
Subject: Re: ports/65487: net-snmp no longer sets tcp.tcpCurrEstab.0
Date: Tue, 13 Apr 2004 06:13:26 -0700 (PDT)

 Update to suggested fix:
 
 Index: Makefile
 ===================================================================
 RCS file: /u1/cvsup/FreeBSD-cvs/root/ports/ports/net-mgmt/net-snmp/Makefile,v
 retrieving revision 1.107
 diff -u -r1.107 Makefile
 --- Makefile    5 Apr 2004 02:43:47 -0000       1.107
 +++ Makefile    13 Apr 2004 13:09:49 -0000
 @@ -93,7 +93,7 @@
  NET_SNMP_PERSISTENTDIR?=/var/net-snmp
  NET_SNMP_MIB_MODULES?= ${NET_SNMP_MIB_MODULE_LIST}
  
 -NET_SNMP_MIB_MODULE_LIST=host disman/event-mib smux mibII/mta_sendmail
 ucd-snmp/diskio
 +NET_SNMP_MIB_MODULE_LIST=host disman/event-mib smux mibII/mta_sendmail
 ucd-snmp/diskio mibII/tcpTable
  _NET_SNMP_MIB_MODULES=
  .for module1 in ${NET_SNMP_MIB_MODULE_LIST}
  _module1=${module1}
 
 
 Sorry about any word wrap that happens, it's a very small patch anyway.
 
 
 	
 		
 __________________________________
 Do you Yahoo!?
 Yahoo! Small Business $15K Web Design Giveaway 
 http://promotions.yahoo.com/design_giveaway/

From: Jun Kuriyama <kuriyama@imgsrc.co.jp>
To: Kenneth Stailey <kstailey@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.org, kuriyama@FreeBSD.org
Subject: Re: ports/65487: net-snmp no longer sets tcp.tcpCurrEstab.0
Date: Tue, 13 Apr 2004 23:06:12 +0900

 At Tue, 13 Apr 2004 06:13:26 -0700 (PDT),
 Kenneth Stailey wrote:
 > Update to suggested fix:
 > 
 > Index: Makefile
 > ===================================================================
 > RCS file: /u1/cvsup/FreeBSD-cvs/root/ports/ports/net-mgmt/net-snmp/Makefile,v
 > retrieving revision 1.107
 > diff -u -r1.107 Makefile
 > --- Makefile    5 Apr 2004 02:43:47 -0000       1.107
 > +++ Makefile    13 Apr 2004 13:09:49 -0000
 > @@ -93,7 +93,7 @@
 >  NET_SNMP_PERSISTENTDIR?=/var/net-snmp
 >  NET_SNMP_MIB_MODULES?= ${NET_SNMP_MIB_MODULE_LIST}
 >  
 > -NET_SNMP_MIB_MODULE_LIST=host disman/event-mib smux mibII/mta_sendmail
 > ucd-snmp/diskio
 > +NET_SNMP_MIB_MODULE_LIST=host disman/event-mib smux mibII/mta_sendmail
 > ucd-snmp/diskio mibII/tcpTable
 >  _NET_SNMP_MIB_MODULES=
 >  .for module1 in ${NET_SNMP_MIB_MODULE_LIST}
 >  _module1=${module1}
 > 
 > Sorry about any word wrap that happens, it's a very small patch anyway.
 
 Hmm, with my quick test, this patch does not solve this...  On my test
 box, I cannot retrive tcpconnestab value yet.
 
 I'll track this more.
 
 
 -- 
 Jun Kuriyama <kuriyama@imgsrc.co.jp> // IMG SRC, Inc.
              <kuriyama@FreeBSD.org> // FreeBSD Project

From: Jun Kuriyama <kuriyama@imgsrc.co.jp>
To: Kenneth Stailey <kstailey@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.org, kuriyama@FreeBSD.org
Subject: Re: ports/65487: net-snmp no longer sets tcp.tcpCurrEstab.0
Date: Wed, 14 Apr 2004 00:05:29 +0900

 At Tue, 13 Apr 2004 23:06:12 +0900,
 kuriyama wrote:
 > Hmm, with my quick test, this patch does not solve this...  On my test
 > box, I cannot retrive tcpconnestab value yet.
 > 
 > I'll track this more.
 
 Today's diagnose...
 
 On my environment, this value is returned from line 344 of
 agent/mibgroup/mibII/tcp.c.
 
     case TCPCURRESTAB:
         ret_value = TCP_Count_Connections();
         type = ASN_GAUGE;
         break;
 
 This function is defined in tcpTable.c:
 
 int TCP_Count_Connections( void ) {
     return tcp_estab;
 }
 
 But we don't have the code to increment this value.
 
 
 -- 
 Jun Kuriyama <kuriyama@imgsrc.co.jp> // IMG SRC, Inc.
              <kuriyama@FreeBSD.org> // FreeBSD Project
Responsible-Changed-From-To: freebsd-ports-bugs->kuriyama 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Apr 13 13:13:31 PDT 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65487 

From: Kenneth Stailey <kstailey@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: kuriyama@FreeBSD.org
Subject: Re: ports/65487: net-snmp no longer sets tcp.tcpCurrEstab.0
Date: Tue, 13 Apr 2004 17:35:41 -0700 (PDT)

 Fixed.
 
 snmpget -c public -v 2c localhost tcp.tcpCurrEstab.0
 TCP-MIB::tcpCurrEstab.0 = Gauge32: 14
 
 
 diff -u tcpTable.c.DIST tcpTable.c
 --- tcpTable.c.DIST     Tue Apr 13 20:27:06 2004
 +++ tcpTable.c  Tue Apr 13 20:35:10 2004
 @@ -277,6 +277,10 @@
  
  int
  TCP_Count_Connections( void ) {
 +#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
 +    tcpTable_load(NULL, NULL);
 +#endif
 +
      return tcp_estab;
  }
  
 @@ -693,6 +697,7 @@
      struct xinpgen *xig = NULL;
      netsnmp_inpcb  *nnew;
      int      StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
 +    struct tcpcb *tp = NULL;
  
      tcpTable_free(NULL, NULL);
  
 @@ -719,12 +724,13 @@
          nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
          if (!nnew)
              break;
 -#if 0
 -        nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state];
 +
 +       tp = &((struct xtcpcb *)xig)->xt_tp;
 +       nnew->state = StateMap[tp->t_state];
          if (nnew->state == 5 /* established */ ||
              nnew->state == 8 /*  closeWait  */ )
              tcp_estab++;
 -#endif
 +
          memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
                             sizeof(struct inpcb));
  
 
 
 
 	
 		
 __________________________________
 Do you Yahoo!?
 Yahoo! Tax Center - File online by April 15th
 http://taxes.yahoo.com/filing.html

From: Jun Kuriyama <kuriyama@imgsrc.co.jp>
To: Kenneth Stailey <kstailey@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.org, kuriyama@FreeBSD.org
Subject: Re: ports/65487: net-snmp no longer sets tcp.tcpCurrEstab.0
Date: Wed, 14 Apr 2004 09:42:03 +0900

 At Tue, 13 Apr 2004 17:35:41 -0700 (PDT),
 Kenneth Stailey wrote:
 > Fixed.
 > 
 > snmpget -c public -v 2c localhost tcp.tcpCurrEstab.0
 > TCP-MIB::tcpCurrEstab.0 = Gauge32: 14
 
 Thanks!  Looks good.  I'll commit after testing.
 
 
 -- 
 Jun Kuriyama <kuriyama@imgsrc.co.jp> // IMG SRC, Inc.
              <kuriyama@FreeBSD.org> // FreeBSD Project
State-Changed-From-To: open->closed 
State-Changed-By: kuriyama 
State-Changed-When: Tue Apr 13 17:57:57 PDT 2004 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65487 
>Unformatted:
