Fix tcp.tcpCurrEstab.0 counting.

PR:		ports/65487
Submitted by:	Ken Stailey <kstailey@yahoo.com>
This commit is contained in:
Jun Kuriyama 2004-04-14 00:57:42 +00:00
parent ca730a0a4c
commit b678598ab5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=106975
6 changed files with 93 additions and 30 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= snmp
PORTVERSION= 5.1.1
PORTREVISION= 1
PKGNAMEPREFIX= net-
CATEGORIES= net-mgmt ipv6
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
@ -93,7 +94,7 @@ NET_SNMP_LOGFILE?= /var/log/snmpd.log
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 mibII/tcpTable ucd-snmp/diskio
_NET_SNMP_MIB_MODULES=
.for module1 in ${NET_SNMP_MIB_MODULE_LIST}
_module1=${module1}

View file

@ -1,6 +1,6 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Fri Nov 14 14:49:21 2003
+++ agent/mibgroup/mibII/tcpTable.c Fri Nov 14 15:14:16 2003
@@ -84,6 +84,8 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Tue Mar 16 08:27:45 2004
+++ agent/mibgroup/mibII/tcpTable.c Wed Apr 14 09:40:00 2004
@@ -95,6 +95,8 @@
#define TCPTABLE_REMOTEADDRESS pcb.inp_faddr.s_addr
#define TCPTABLE_REMOTEPORT pcb.inp_fport
#define TCPTABLE_IS_LINKED_LIST
@ -9,18 +9,38 @@
#endif /* linux */
#endif /* WIN32 */
@@ -695,11 +697,13 @@
@@ -275,6 +277,9 @@
int
TCP_Count_Connections( void ) {
+#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
+ tcpTable_load(NULL, NULL);
+#endif
return tcp_estab;
}
@@ -691,6 +696,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);
@@ -717,12 +723,13 @@
nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
if (!nnew)
break;
+#if 0
nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state];
- 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++;
- memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xt_inp),
+#endif
+ memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
sizeof(struct inpcb));
- sizeof(struct inpcb));
+ memcpy(&(nnew->pcb), &(((struct xtcpcb *) xig)->xt_tp),
+ sizeof(struct tcpcb));
nnew->inp_next = tcp_head;
tcp_head = nnew;

View file

@ -7,6 +7,7 @@
PORTNAME= snmp
PORTVERSION= 5.1.1
PORTREVISION= 1
PKGNAMEPREFIX= net-
CATEGORIES= net-mgmt ipv6
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
@ -93,7 +94,7 @@ NET_SNMP_LOGFILE?= /var/log/snmpd.log
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 mibII/tcpTable ucd-snmp/diskio
_NET_SNMP_MIB_MODULES=
.for module1 in ${NET_SNMP_MIB_MODULE_LIST}
_module1=${module1}

View file

@ -1,6 +1,6 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Fri Nov 14 14:49:21 2003
+++ agent/mibgroup/mibII/tcpTable.c Fri Nov 14 15:14:16 2003
@@ -84,6 +84,8 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Tue Mar 16 08:27:45 2004
+++ agent/mibgroup/mibII/tcpTable.c Wed Apr 14 09:40:00 2004
@@ -95,6 +95,8 @@
#define TCPTABLE_REMOTEADDRESS pcb.inp_faddr.s_addr
#define TCPTABLE_REMOTEPORT pcb.inp_fport
#define TCPTABLE_IS_LINKED_LIST
@ -9,18 +9,38 @@
#endif /* linux */
#endif /* WIN32 */
@@ -695,11 +697,13 @@
@@ -275,6 +277,9 @@
int
TCP_Count_Connections( void ) {
+#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
+ tcpTable_load(NULL, NULL);
+#endif
return tcp_estab;
}
@@ -691,6 +696,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);
@@ -717,12 +723,13 @@
nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
if (!nnew)
break;
+#if 0
nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state];
- 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++;
- memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xt_inp),
+#endif
+ memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
sizeof(struct inpcb));
- sizeof(struct inpcb));
+ memcpy(&(nnew->pcb), &(((struct xtcpcb *) xig)->xt_tp),
+ sizeof(struct tcpcb));
nnew->inp_next = tcp_head;
tcp_head = nnew;

View file

@ -7,6 +7,7 @@
PORTNAME= snmp
PORTVERSION= 5.1.1
PORTREVISION= 1
PKGNAMEPREFIX= net-
CATEGORIES= net-mgmt ipv6
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
@ -93,7 +94,7 @@ NET_SNMP_LOGFILE?= /var/log/snmpd.log
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 mibII/tcpTable ucd-snmp/diskio
_NET_SNMP_MIB_MODULES=
.for module1 in ${NET_SNMP_MIB_MODULE_LIST}
_module1=${module1}

View file

@ -1,6 +1,6 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Fri Nov 14 14:49:21 2003
+++ agent/mibgroup/mibII/tcpTable.c Fri Nov 14 15:14:16 2003
@@ -84,6 +84,8 @@
--- agent/mibgroup/mibII/tcpTable.c.orig Tue Mar 16 08:27:45 2004
+++ agent/mibgroup/mibII/tcpTable.c Wed Apr 14 09:40:00 2004
@@ -95,6 +95,8 @@
#define TCPTABLE_REMOTEADDRESS pcb.inp_faddr.s_addr
#define TCPTABLE_REMOTEPORT pcb.inp_fport
#define TCPTABLE_IS_LINKED_LIST
@ -9,18 +9,38 @@
#endif /* linux */
#endif /* WIN32 */
@@ -695,11 +697,13 @@
@@ -275,6 +277,9 @@
int
TCP_Count_Connections( void ) {
+#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
+ tcpTable_load(NULL, NULL);
+#endif
return tcp_estab;
}
@@ -691,6 +696,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);
@@ -717,12 +723,13 @@
nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
if (!nnew)
break;
+#if 0
nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state];
- 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++;
- memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xt_inp),
+#endif
+ memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp),
sizeof(struct inpcb));
- sizeof(struct inpcb));
+ memcpy(&(nnew->pcb), &(((struct xtcpcb *) xig)->xt_tp),
+ sizeof(struct tcpcb));
nnew->inp_next = tcp_head;
tcp_head = nnew;