From 753aef952ebfa3f6bfe20f98728e29b4bd712cd7 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 28 Jun 2008 16:06:34 +0000 Subject: Look what you made me do clown boy! (Adapt to new tcp stats array) --- net/net-snmp/patches/patch-dl | 89 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 4 deletions(-) (limited to 'net') diff --git a/net/net-snmp/patches/patch-dl b/net/net-snmp/patches/patch-dl index 3f006cdf9cc..c7f60dd4f0f 100644 --- a/net/net-snmp/patches/patch-dl +++ b/net/net-snmp/patches/patch-dl @@ -1,11 +1,16 @@ -$NetBSD: patch-dl,v 1.3 2007/02/05 12:06:16 adam Exp $ +$NetBSD: patch-dl,v 1.4 2008/06/28 16:06:34 christos Exp $ ---- agent/mibgroup/mibII/tcp.c.orig 2006-09-15 02:48:40.000000000 +0200 -+++ agent/mibgroup/mibII/tcp.c -@@ -177,6 +177,11 @@ init_tcp(void) +--- agent/mibgroup/mibII/tcp.c.orig 2007-07-16 19:59:44.000000000 -0400 ++++ agent/mibgroup/mibII/tcp.c 2008-06-28 11:15:21.000000000 -0400 +@@ -177,6 +177,16 @@ #define USES_TRADITIONAL_TCPSTAT #endif ++#ifdef TCP_NSTATS ++typedef uint32_t tcp_stats[TCP_NSTATS]; ++#define TCP_STAT_STRUCTURE tcp_stats ++#endif ++ +#ifdef dragonfly +#define TCP_STAT_STRUCTURE struct tcp_stats +#define USES_TRADITIONAL_TCPSTAT @@ -14,3 +19,79 @@ $NetBSD: patch-dl,v 1.3 2007/02/05 12:06:16 adam Exp $ #if !defined(TCP_STAT_STRUCTURE) #define TCP_STAT_STRUCTURE struct tcpstat #define USES_TRADITIONAL_TCPSTAT +@@ -309,6 +319,75 @@ + #endif /* linux */ + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); + continue; ++#elif defined(TCP_NSTAT) ++ case TCPRTOALGORITHM: /* Assume Van Jacobsen's algorithm */ ++ ret_value = 4; ++ type = ASN_INTEGER; ++ break; ++ case TCPRTOMIN: ++#ifdef TCPTV_NEEDS_HZ ++ ret_value = TCPTV_MIN; ++#else ++ ret_value = TCPTV_MIN / PR_SLOWHZ * 1000; ++#endif ++ type = ASN_INTEGER; ++ break; ++ case TCPRTOMAX: ++#ifdef TCPTV_NEEDS_HZ ++ ret_value = TCPTV_REXMTMAX; ++#else ++ ret_value = TCPTV_REXMTMAX / PR_SLOWHZ * 1000; ++#endif ++ type = ASN_INTEGER; ++ break; ++ case TCPMAXCONN: ++ ret_value = -1; /* Dynamic maximum */ ++ type = ASN_INTEGER; ++ break; ++ case TCPACTIVEOPENS: ++ ret_value = tcpstat[TCP_STAT_CONNATTEMPT]; ++ break; ++ case TCPPASSIVEOPENS: ++ ret_value = tcpstat[TCP_STAT_ACCEPTS]; ++ break; ++ /* ++ * NB: tcps_drops is actually the sum of the two MIB ++ * counters tcpAttemptFails and tcpEstabResets. ++ */ ++ case TCPATTEMPTFAILS: ++ ret_value = tcpstat[TCP_STAT_CONNDROPS]; ++ break; ++ case TCPESTABRESETS: ++ ret_value = tcpstat[TCP_STAT_DROPS]; ++ break; ++ case TCPCURRESTAB: ++#ifdef USING_MIBII_TCPTABLE_MODULE ++ ret_value = TCP_Count_Connections(); ++#else ++ ret_value = 0; ++#endif ++ type = ASN_GAUGE; ++ break; ++ case TCPINSEGS: ++ ret_value = tcpstat[TCP_STAT_RCVTOTAL]; ++ break; ++ case TCPOUTSEGS: ++ /* ++ * RFC 1213 defines this as the number of segments sent ++ * "excluding those containing only retransmitted octets" ++ */ ++ ret_value = tcpstat[TCP_STAT_SNDTOTAL] - tcpstat[TCP_STAT_SNDREXMITPACK]; ++ break; ++ case TCPRETRANSSEGS: ++ ret_value = tcpstat[TCP_STAT_SNDREXMITPACK]; ++ break; ++ case TCPINERRS: ++ ret_value = tcpstat[TCP_STAT_RCVBADSUM] + tcpstat[TCP_STAT_RCVBADOFF] ++ + tcpstat[TCP_STAT_RCVMEMDROP] + tcpstat[TCP_STAT_RCVSHORT]; ++ break; ++ case TCPOUTRSTS: ++ ret_value = tcpstat[TCP_STAT_SNDCTRL] - tcpstat[TCP_STAT_CLOSED]; ++ break; + #elif defined(USES_TRADITIONAL_TCPSTAT) && !defined(_USE_FIRST_PROTOCOL) + #ifdef HAVE_SYS_TCPIPSTATS_H + /* -- cgit v1.2.3