The mib element tcp.tcpCurrEstab.0 was not working, then it got fixed but it's broken again. 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 How-To-Repeat: http://www.freshports.org/phorum/read.php?f=2&i=157&t=157
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/
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
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 Over to maintainer.
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
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 Committed, thanks!