diff options
author | adam <adam@pkgsrc.org> | 2010-05-11 04:39:54 +0000 |
---|---|---|
committer | adam <adam@pkgsrc.org> | 2010-05-11 04:39:54 +0000 |
commit | e81d5066998fda421a4e88bbffc7e8c39815b631 (patch) | |
tree | 649e2ede4446dfeb936289618f9b194b57e66ffd | |
parent | 5e042ddd400592573681ba5a0fcaaee5fbf15a31 (diff) | |
download | pkgsrc-e81d5066998fda421a4e88bbffc7e8c39815b631.tar.gz |
Added patches, courtesy of Mike Bowie:
* Address changes in sysctl() storage, which has yielded values such as
IP-MIB::ipForwarding.0 invalid.
* RAM reporting on 64-bit systems.
-rw-r--r-- | net/net-snmp/Makefile | 6 | ||||
-rw-r--r-- | net/net-snmp/distinfo | 13 | ||||
-rw-r--r-- | net/net-snmp/options.mk | 15 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ah | 19 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-et | 39 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-eu | 39 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ev | 199 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ew | 96 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ex | 14 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ey | 39 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-ez | 50 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-fa | 14 | ||||
-rw-r--r-- | net/net-snmp/patches/patch-fb | 13 |
13 files changed, 539 insertions, 17 deletions
diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile index 04dc44b7f44..cce87c625fa 100644 --- a/net/net-snmp/Makefile +++ b/net/net-snmp/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.79 2010/03/09 22:52:56 hubertf Exp $ +# $NetBSD: Makefile,v 1.80 2010/05/11 04:39:54 adam Exp $ DISTNAME= net-snmp-5.4.2.1 -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=net-snmp/} @@ -56,7 +56,7 @@ CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} CONFIGURE_ARGS+= --with-libwrap=${BUILDLINK_PREFIX.tcp_wrappers}/lib CONFIGURE_ARGS+= --with-sys-contact=${NET_SNMP_SYS_CONTACT:Q} CONFIGURE_ARGS+= --with-sys-location=${NET_SNMP_SYS_LOCATION:Q} -CONFIGURE_ARGS+= --with-install-prefix=${DESTDIR:Q} +CONFIGURE_ARGS+= --with-install-prefix=${DESTDIR} # # NOTE: if you specify a logfile then this file will be written to by # default and although it can be disabled on the command line, the diff --git a/net/net-snmp/distinfo b/net/net-snmp/distinfo index d2335739c90..4b1ad4f53d1 100644 --- a/net/net-snmp/distinfo +++ b/net/net-snmp/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.54 2009/03/10 18:36:33 apb Exp $ +$NetBSD: distinfo,v 1.55 2010/05/11 04:39:54 adam Exp $ SHA1 (net-snmp-5.4.2.1.tar.gz) = 4f2df9ea62344fe840f493d0e08abe5de3697862 RMD160 (net-snmp-5.4.2.1.tar.gz) = 2148c42d486ed88f9cfc3ca1d50c68abcd7e3d63 @@ -10,7 +10,7 @@ SHA1 (patch-ad) = 4af27886f93bf018f6794c3f8b8dcb9b08389163 SHA1 (patch-ae) = 721e62bb42b6d3787f36316cf2628cd71ae6a6ce SHA1 (patch-af) = a71f0522a1db1de0db0ec3c576635557549a327b SHA1 (patch-ag) = 7021f7238c37635c9c32ceca681fd42aa125437f -SHA1 (patch-ah) = 9ad04b5c0046a82c4e601e4f3abb2dd491846489 +SHA1 (patch-ah) = 7d4a6fa1cc370da2301da952dabdb996b52fb0f7 SHA1 (patch-ai) = c57baca06856187115db39fd50668203dad0a94c SHA1 (patch-aj) = 30c28c4801cea33d54e68bbde603e7d531dfb2f8 SHA1 (patch-ak) = cccad21d4f56e79799a433ef7bf0e8ff4e917afb @@ -44,3 +44,12 @@ SHA1 (patch-ei) = 7eb4899b08b73c79f1eb8616bcebad38c0fbe148 SHA1 (patch-el) = f80dc7058b8a60e3be53e5673538f6eb2d173b68 SHA1 (patch-ep) = 91029b17538360ba09e8e74943d2c4481f89a33a SHA1 (patch-es) = c26c048ccbda7e4d28cb0a2263cdaa71befb4f96 +SHA1 (patch-et) = 5a352594bfde763c215eb8b0d18951add1f3e777 +SHA1 (patch-eu) = c0521de99c52c517509a76b55a62640fdce06d40 +SHA1 (patch-ev) = 4a686c44e73a7d9d6a792db1f1a5b20fc654e33e +SHA1 (patch-ew) = 2f96f61269723adbb4df0cd0adc65d0e0abb6b01 +SHA1 (patch-ex) = ac1876e54fd7bc643ae8a290f83ce4ab3b50d7c6 +SHA1 (patch-ey) = a3a3f99bdffef7d137958e59ac829fb92b86d976 +SHA1 (patch-ez) = 812fffcf992a040677cbb05d8a8344d221203030 +SHA1 (patch-fa) = ea4243dd36395d16ee1a6b2eccce9ef833a9308b +SHA1 (patch-fb) = 64d97a51d82488ef4d3ea5dd40278501975d58fb diff --git a/net/net-snmp/options.mk b/net/net-snmp/options.mk index 85a93cb4943..eb76cf720a5 100644 --- a/net/net-snmp/options.mk +++ b/net/net-snmp/options.mk @@ -1,4 +1,4 @@ -# $NetBSD: options.mk,v 1.9 2010/03/09 22:52:56 hubertf Exp $ +# $NetBSD: options.mk,v 1.10 2010/05/11 04:39:54 adam Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.net-snmp PKG_SUPPORTED_OPTIONS= ssl snmp-unprived snmp-nokmem perl @@ -41,15 +41,14 @@ CONFIGURE_ARGS+= --without-root-access # can't load the shared libraries from WRKSRC/ # Until this is fixed you can test them after installation by doing # `make test TEST_TARGET=perltest' -TEST_TARGET= test +TEST_TARGET= test # Enable the perl modules build and installation -# -PERL5_CONFIGURE= no -PERL5_PACKLIST= auto/Bundle/NetSNMP/.packlist -CONFIGURE_ARGS+= --with-perl-modules=${MAKE_PARAMS:Q} -CONFIGURE_ENV+= PERLPROG=${PERL5:Q} -USE_TOOLS+=perl +USE_TOOLS+= perl +PERL5_CONFIGURE= no +PERL5_PACKLIST= auto/Bundle/NetSNMP/.packlist +CONFIGURE_ARGS+= --with-perl-modules=${MAKE_PARAMS:Q} +CONFIGURE_ENV+= PERLPROG=${PERL5:Q} .include "../../lang/perl5/module.mk" .else # !perl diff --git a/net/net-snmp/patches/patch-ah b/net/net-snmp/patches/patch-ah index 39a991f5883..ab80b70dfc0 100644 --- a/net/net-snmp/patches/patch-ah +++ b/net/net-snmp/patches/patch-ah @@ -1,7 +1,7 @@ -$NetBSD: patch-ah,v 1.4 2008/01/03 19:10:10 seb Exp $ +$NetBSD: patch-ah,v 1.5 2010/05/11 04:39:54 adam Exp $ --- agent/mibgroup/hardware/memory/memory_netbsd.c.orig 2006-03-06 16:23:52.000000000 +0000 -+++ agent/mibgroup/hardware/memory/memory_netbsd.c ++++ agent/mibgroup/hardware/memory/memory_netbsd.c 2010-04-21 21:58:02.000000000 +0000 @@ -4,6 +4,7 @@ #include <net-snmp/agent/hardware/memory.h> @@ -10,7 +10,7 @@ $NetBSD: patch-ah,v 1.4 2008/01/03 19:10:10 seb Exp $ #include <sys/sysctl.h> #include <sys/swap.h> -@@ -30,7 +31,7 @@ int netsnmp_mem_arch_load( netsnmp_cache +@@ -30,7 +31,7 @@ long pagesize; struct uvmexp uvmexp; @@ -19,7 +19,18 @@ $NetBSD: patch-ah,v 1.4 2008/01/03 19:10:10 seb Exp $ int uvmexp_mib[] = { CTL_VM, VM_UVMEXP }; struct vmtotal total; -@@ -46,10 +47,22 @@ int netsnmp_mem_arch_load( netsnmp_cache +@@ -40,16 +41,33 @@ + long phys_mem; + long user_mem; + size_t mem_size = sizeof(phys_mem); ++#if defined(__x86_64__) ++ int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM64 }; ++ int user_mem_mib[] = { CTL_HW, HW_USERMEM64 }; ++#else + int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM }; + int user_mem_mib[] = { CTL_HW, HW_USERMEM }; ++#endif + /* * Retrieve the memory information from the underlying O/S... */ diff --git a/net/net-snmp/patches/patch-et b/net/net-snmp/patches/patch-et new file mode 100644 index 00000000000..f0e366a97d0 --- /dev/null +++ b/net/net-snmp/patches/patch-et @@ -0,0 +1,39 @@ +$NetBSD: patch-et,v 1.4 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/icmp.c.orig 2010-03-12 00:31:17.000000000 +0000 ++++ agent/mibgroup/mibII/icmp.c 2010-03-12 00:33:41.000000000 +0000 +@@ -127,6 +127,12 @@ + #define USES_SNMP_DESIGNED_ICMPSTAT + #endif + ++#ifdef netbsd4 ++#define ICMP_STAT_STRUCTURE struct icmp_mib ++#define USES_SNMP_DESIGNED_ICMPSTAT ++#undef ICMP_NSTATS ++#endif ++ + #if defined (WIN32) || defined (cygwin) + #include <iphlpapi.h> + #define ICMP_STAT_STRUCTURE MIB_ICMP +@@ -706,6 +712,21 @@ + } + return ret_value; + } ++#elif defined(netbsd4) ++int ++icmp_load(netsnmp_cache *cache, void *vmagic) ++{ ++ long ret_value =- -1; ++ ++ ret_value = netbsd_read_icmp_stat(&icmpstat); ++ ++ if ( ret_value < 0 ) { ++ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (netbsd)\n")); ++ } else { ++ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (netbsd)\n")); ++ } ++ return ret_value; ++} + #elif defined (WIN32) || defined (cygwin) + int + icmp_load(netsnmp_cache *cache, void *vmagic) diff --git a/net/net-snmp/patches/patch-eu b/net/net-snmp/patches/patch-eu new file mode 100644 index 00000000000..79fda4a294a --- /dev/null +++ b/net/net-snmp/patches/patch-eu @@ -0,0 +1,39 @@ +$NetBSD: patch-eu,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/ip.c.orig 2010-03-12 00:31:27.000000000 +0000 ++++ agent/mibgroup/mibII/ip.c 2010-03-12 00:33:50.000000000 +0000 +@@ -199,6 +199,12 @@ + #define USES_SNMP_DESIGNED_IPSTAT + #endif + ++#ifdef netbsd4 ++#define IP_STAT_STRUCTURE struct ip_mib ++#define USES_SNMP_DESIGNED_IPSTAT ++#undef IP_NSTATS ++#endif ++ + #if defined (WIN32) || defined (cygwin) + #include <iphlpapi.h> + #define IP_STAT_STRUCTURE MIB_IPSTATS +@@ -804,6 +810,21 @@ + } + return ret_value; + } ++#elif defined (netbsd4) ++int ++ip_load(netsnmp_cache *cache, void *vmagic) ++{ ++ long ret_value = -1; ++ ++ ret_value = netbsd_read_ip_stat(&ipstat); ++ ++ if ( ret_value < 0) { ++ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (netbsd)\n")); ++ } else { ++ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (netbsd)\n")); ++ } ++ return ret_value; ++} + #elif defined (WIN32) || defined (cygwin) + int + ip_load(netsnmp_cache *cache, void *vmagic) diff --git a/net/net-snmp/patches/patch-ev b/net/net-snmp/patches/patch-ev new file mode 100644 index 00000000000..031da8e1e31 --- /dev/null +++ b/net/net-snmp/patches/patch-ev @@ -0,0 +1,199 @@ +$NetBSD: patch-ev,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/kernel_netbsd.c.orig 2010-03-12 00:47:14.000000000 +0000 ++++ agent/mibgroup/mibII/kernel_netbsd.c 2010-03-12 01:40:58.000000000 +0000 +@@ -0,0 +1,194 @@ ++/* ++ * NetBSD implementation for mapping the IP stat arrays into struct's ++ * Required for NetBSD versions produced after April 7th 2008 (4+) ++ * ++ * Based on: http://mail-index.netbsd.org/pkgsrc-users/2008/04/27/msg007095.html ++ */ ++ ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#include <sys/protosw.h> ++ ++#include <netinet/in.h> ++#include <netinet/in_systm.h> ++#include <netinet/ip.h> ++#include <netinet/ip_icmp.h> ++#include <netinet/ip_var.h> ++#include <netinet/icmp_var.h> ++#include <netinet/tcp.h> ++#include <netinet/tcp_timer.h> ++#include <netinet/tcp_var.h> ++#include <netinet/udp.h> ++#include <netinet/udp_var.h> ++ ++#include <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++ ++#include "kernel_netbsd.h" ++ ++int ++netbsd_read_icmp_stat(struct icmp_mib *mib) ++{ ++ size_t size; ++ uint64_t icmpstat[ICMP_NSTATS]; ++ int i; ++ ++ (void)memset(mib, 0, sizeof(*mib)); ++ ++ if (-1 == sysctlbyname("net.inet.icmp.stats", icmpstat, &size, NULL, 0)) ++ return -1; ++ ++ mib->icmpInMsgs = icmpstat[ICMP_STAT_BADCODE] ++ + icmpstat[ICMP_STAT_TOOSHORT] ++ + icmpstat[ICMP_STAT_CHECKSUM] ++ + icmpstat[ICMP_STAT_BADLEN]; ++ for (i = 0; i <= ICMP_MAXTYPE; i++) ++ mib->icmpInMsgs += icmpstat[ICMP_STAT_INHIST + i]; ++ mib->icmpInErrors = icmpstat[ICMP_STAT_BADCODE] ++ + icmpstat[ICMP_STAT_TOOSHORT] ++ + icmpstat[ICMP_STAT_CHECKSUM] ++ + icmpstat[ICMP_STAT_BADLEN]; ++ mib->icmpInDestUnreachs = icmpstat[ICMP_STAT_INHIST + ICMP_UNREACH]; ++ mib->icmpInTimeExcds = icmpstat[ICMP_STAT_INHIST + ICMP_TIMXCEED]; ++ mib->icmpInParmProbs = icmpstat[ICMP_STAT_INHIST + ICMP_PARAMPROB]; ++ mib->icmpInSrcQuenchs = icmpstat[ICMP_STAT_INHIST + ICMP_SOURCEQUENCH]; ++ mib->icmpInRedirects = icmpstat[ICMP_STAT_INHIST + ICMP_REDIRECT]; ++ mib->icmpInEchos = icmpstat[ICMP_STAT_INHIST + ICMP_ECHO]; ++ mib->icmpInEchoReps = icmpstat[ICMP_STAT_INHIST + ICMP_ECHOREPLY]; ++ mib->icmpInTimestamps = icmpstat[ICMP_STAT_INHIST + ICMP_TSTAMP]; ++ mib->icmpInTimestampReps ++ = icmpstat[ICMP_STAT_INHIST + ICMP_TSTAMPREPLY]; ++ mib->icmpInAddrMasks = icmpstat[ICMP_STAT_INHIST + ICMP_MASKREQ]; ++ mib->icmpInAddrMaskReps = icmpstat[ICMP_STAT_INHIST + ICMP_MASKREPLY]; ++ mib->icmpOutMsgs = icmpstat[ICMP_STAT_OLDSHORT] ++ + icmpstat[ICMP_STAT_OLDICMP]; ++ for (i = 0; i <= ICMP_MAXTYPE; i++) ++ mib->icmpOutMsgs += icmpstat[ICMP_STAT_OUTHIST + i]; ++ mib->icmpOutErrors = icmpstat[ICMP_STAT_OLDSHORT] ++ + icmpstat[ICMP_STAT_OLDICMP]; ++ mib->icmpOutDestUnreachs = icmpstat[ICMP_STAT_OUTHIST + ICMP_UNREACH]; ++ mib->icmpOutTimeExcds = icmpstat[ICMP_STAT_OUTHIST + ICMP_TIMXCEED]; ++ mib->icmpOutParmProbs = icmpstat[ICMP_STAT_OUTHIST + ICMP_PARAMPROB]; ++ mib->icmpOutSrcQuenchs ++ = icmpstat[ICMP_STAT_OUTHIST + ICMP_SOURCEQUENCH]; ++ mib->icmpOutRedirects = icmpstat[ICMP_STAT_OUTHIST + ICMP_REDIRECT]; ++ mib->icmpOutEchos = icmpstat[ICMP_STAT_OUTHIST + ICMP_ECHO]; ++ mib->icmpOutEchoReps = icmpstat[ICMP_STAT_OUTHIST + ICMP_ECHOREPLY]; ++ mib->icmpOutTimestamps = icmpstat[ICMP_STAT_OUTHIST + ICMP_TSTAMP]; ++ mib->icmpOutTimestampReps ++ = icmpstat[ICMP_STAT_OUTHIST + ICMP_TSTAMPREPLY]; ++ mib->icmpOutAddrMasks = icmpstat[ICMP_STAT_OUTHIST + ICMP_MASKREQ]; ++ mib->icmpOutAddrMaskReps = icmpstat[ICMP_STAT_OUTHIST + ICMP_MASKREPLY]; ++ ++ return 0; ++} ++ ++int ++netbsd_read_ip_stat(struct ip_mib *mib) ++{ ++ size_t size; ++ uint64_t ipstat[IP_NSTATS]; ++ int i; ++ static int sname[4] = { 4, 2, 0, 0 }; // CTL_NET, PF_INET, IPPROTO_IP, 0 ++ size_t len; ++ ++ (void)memset(mib, 0, sizeof(*mib)); ++ ++ if (-1 == sysctlbyname("net.inet.ip.stats", ipstat, &size, NULL, 0)) ++ return -1; ++ ++ mib->ipForwarding = 0; ++ len = sizeof i; ++ sname[3] = IPCTL_FORWARDING; ++ if (0 == sysctl(sname, 4, &i, &len, 0, 0)) { ++ mib->ipForwarding = (long)i; ++ } ++ ++ mib->ipDefaultTTL = 0; ++ sname[3] = IPCTL_DEFTTL; ++ if (0 == sysctl(sname, 4, &i, &len, 0, 0)) { ++ mib->ipDefaultTTL = (long)i; ++ } ++ ++ mib->ipInReceives = ipstat[IP_STAT_TOTAL]; ++ mib->ipInHdrErrors = ipstat[IP_STAT_BADSUM] ++ + ipstat[IP_STAT_TOOSHORT] + ipstat[IP_STAT_TOOSMALL] ++ + ipstat[IP_STAT_BADHLEN] + ipstat[IP_STAT_BADLEN]; ++ mib->ipInAddrErrors = ipstat[IP_STAT_CANTFORWARD]; ++ mib->ipForwDatagrams = ipstat[IP_STAT_FORWARD]; ++ mib->ipInUnknownProtos = ipstat[IP_STAT_NOPROTO]; ++ mib->ipInDiscards = ipstat[IP_STAT_FRAGDROPPED]; /* FIXME */ ++ mib->ipInDelivers = ipstat[IP_STAT_DELIVERED]; ++ mib->ipOutRequests = ipstat[IP_STAT_LOCALOUT]; ++ mib->ipOutDiscards = ipstat[IP_STAT_ODROPPED]; ++ mib->ipOutNoRoutes = 0; /* FIXME */ ++ mib->ipReasmTimeout = 0; /* IPFRAGTTL; */ ++ mib->ipReasmReqds = ipstat[IP_STAT_FRAGMENTS]; ++ mib->ipReasmOKs = ipstat[IP_STAT_REASSEMBLED]; ++ mib->ipReasmFails = ipstat[IP_STAT_FRAGDROPPED] ++ + ipstat[IP_STAT_FRAGTIMEOUT]; ++ mib->ipFragOKs = ipstat[IP_STAT_FRAGMENTS]; ++ mib->ipFragFails = ipstat[IP_STAT_CANTFRAG]; ++ mib->ipFragCreates = ipstat[IP_STAT_OFRAGMENTS]; ++ mib->ipRoutingDiscards = ipstat[IP_STAT_NOROUTE]; ++ ++ return 0; ++} ++ ++int ++netbsd_read_tcp_stat(struct tcp_mib *mib) ++{ ++ size_t size; ++ uint64_t tcpstat[TCP_NSTATS]; ++ ++ (void)memset(mib, 0, sizeof(*mib)); ++ ++ if (-1 == sysctlbyname("net.inet.tcp.stats", tcpstat, &size, NULL, 0)) ++ return -1; ++ ++ mib->tcpRtoAlgorithm = 4; /* Assume Van Jacobsen's algorithm */ ++ mib->tcpRtoMin = TCPTV_MIN; ++ mib->tcpRtoMax = TCPTV_REXMTMAX; ++ mib->tcpMaxConn = -1; /* Dynamic Maximum */ ++ mib->tcpActiveOpens = tcpstat[TCP_STAT_CONNATTEMPT]; ++ mib->tcpPassiveOpens = tcpstat[TCP_STAT_ACCEPTS]; ++ mib->tcpAttemptFails = tcpstat[TCP_STAT_CONNDROPS]; ++ mib->tcpEstabResets = tcpstat[TCP_STAT_DROPS]; ++ mib->tcpCurrEstab = 0; /* FIXME */ ++ mib->tcpInSegs = tcpstat[TCP_STAT_RCVTOTAL]; ++ mib->tcpOutSegs = tcpstat[TCP_STAT_SNDTOTAL] ++ - tcpstat[TCP_STAT_SNDREXMITPACK]; ++ mib->tcpRetransSegs = tcpstat[TCP_STAT_SNDREXMITPACK]; ++ mib->tcpInErrs = tcpstat[TCP_STAT_RCVBADSUM] ++ + tcpstat[TCP_STAT_RCVBADOFF] ++ + tcpstat[TCP_STAT_RCVMEMDROP] ++ + tcpstat[TCP_STAT_RCVSHORT]; ++ mib->tcpOutRsts = tcpstat[TCP_STAT_SNDCTRL] ++ - tcpstat[TCP_STAT_CLOSED]; ++ mib->tcpInErrsValid = mib->tcpInErrs; /* FIXME */ ++ mib->tcpOutRstsValid = mib->tcpOutRsts; /* FIXME */ ++ ++ return 0; ++} ++ ++int ++netbsd_read_udp_stat(struct udp_mib *mib) ++{ ++ size_t size; ++ uint64_t udpstat[UDP_NSTATS]; ++ ++ (void)memset(mib, 0, sizeof(*mib)); ++ ++ if (-1 == sysctlbyname("net.inet.udp.stats", udpstat, &size, NULL, 0)) ++ return -1; ++ ++ mib->udpInDatagrams = udpstat[UDP_STAT_IPACKETS]; ++ mib->udpNoPorts = udpstat[UDP_STAT_NOPORT]; ++ mib->udpOutDatagrams = udpstat[UDP_STAT_OPACKETS]; ++ mib->udpInErrors = udpstat[UDP_STAT_HDROPS] ++ + udpstat[UDP_STAT_BADSUM] //+ udpstat[UDP_STAT_DISCARD] /* FIXME */ ++ + udpstat[UDP_STAT_FULLSOCK] + udpstat[UDP_STAT_BADLEN]; ++ ++ return 0; ++} diff --git a/net/net-snmp/patches/patch-ew b/net/net-snmp/patches/patch-ew new file mode 100644 index 00000000000..e3d8eabc343 --- /dev/null +++ b/net/net-snmp/patches/patch-ew @@ -0,0 +1,96 @@ +$NetBSD: patch-ew,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/kernel_netbsd.h.orig 2010-03-12 00:31:50.000000000 +0000 ++++ agent/mibgroup/mibII/kernel_netbsd.h 2010-03-12 00:31:50.000000000 +0000 +@@ -0,0 +1,91 @@ ++#ifndef _MIBGROUP_KERNEL_NETBSD_H ++#define _MIBGROUP_KERNEL_NETBSD_H ++ ++#if __NetBSD_Version__ >= 499005800 ++ ++struct icmp_mib { ++ unsigned long icmpInMsgs; ++ unsigned long icmpInErrors; ++ unsigned long icmpInDestUnreachs; ++ unsigned long icmpInTimeExcds; ++ unsigned long icmpInParmProbs; ++ unsigned long icmpInSrcQuenchs; ++ unsigned long icmpInRedirects; ++ unsigned long icmpInEchos; ++ unsigned long icmpInEchoReps; ++ unsigned long icmpInTimestamps; ++ unsigned long icmpInTimestampReps; ++ unsigned long icmpInAddrMasks; ++ unsigned long icmpInAddrMaskReps; ++ unsigned long icmpOutMsgs; ++ unsigned long icmpOutErrors; ++ unsigned long icmpOutDestUnreachs; ++ unsigned long icmpOutTimeExcds; ++ unsigned long icmpOutParmProbs; ++ unsigned long icmpOutSrcQuenchs; ++ unsigned long icmpOutRedirects; ++ unsigned long icmpOutEchos; ++ unsigned long icmpOutEchoReps; ++ unsigned long icmpOutTimestamps; ++ unsigned long icmpOutTimestampReps; ++ unsigned long icmpOutAddrMasks; ++ unsigned long icmpOutAddrMaskReps; ++}; ++ ++struct ip_mib { ++ unsigned long ipForwarding; ++ unsigned long ipDefaultTTL; ++ unsigned long ipInReceives; ++ unsigned long ipInHdrErrors; ++ unsigned long ipInAddrErrors; ++ unsigned long ipForwDatagrams; ++ unsigned long ipInUnknownProtos; ++ unsigned long ipInDiscards; ++ unsigned long ipInDelivers; ++ unsigned long ipOutRequests; ++ unsigned long ipOutDiscards; ++ unsigned long ipOutNoRoutes; ++ unsigned long ipReasmTimeout; ++ unsigned long ipReasmReqds; ++ unsigned long ipReasmOKs; ++ unsigned long ipReasmFails; ++ unsigned long ipFragOKs; ++ unsigned long ipFragFails; ++ unsigned long ipFragCreates; ++ unsigned long ipRoutingDiscards; ++}; ++ ++struct tcp_mib { ++ unsigned long tcpRtoAlgorithm; ++ unsigned long tcpRtoMin; ++ unsigned long tcpRtoMax; ++ unsigned long tcpMaxConn; ++ unsigned long tcpActiveOpens; ++ unsigned long tcpPassiveOpens; ++ unsigned long tcpAttemptFails; ++ unsigned long tcpEstabResets; ++ unsigned long tcpCurrEstab; ++ unsigned long tcpInSegs; ++ unsigned long tcpOutSegs; ++ unsigned long tcpRetransSegs; ++ unsigned long tcpInErrs; ++ unsigned long tcpOutRsts; ++ short tcpInErrsValid; ++ short tcpOutRstsValid; ++}; ++ ++struct udp_mib { ++ unsigned long udpInDatagrams; ++ unsigned long udpNoPorts; ++ unsigned long udpInErrors; ++ unsigned long udpOutDatagrams; ++}; ++ ++int netbsd_read_icmp_stat(struct icmp_mib *); ++int netbsd_read_ip_stat(struct ip_mib *); ++int netbsd_read_tcp_stat(struct tcp_mib *); ++int netbsd_read_udp_stat(struct udp_mib *); ++ ++#endif /* __NetBSD_Version__ >= 499005800 */ ++ ++#endif /* _MIBGROUP_KERNEL_NETBSD_H */ diff --git a/net/net-snmp/patches/patch-ex b/net/net-snmp/patches/patch-ex new file mode 100644 index 00000000000..42d0bef908c --- /dev/null +++ b/net/net-snmp/patches/patch-ex @@ -0,0 +1,14 @@ +$NetBSD: patch-ex,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/mibII_common.h.orig 2010-03-12 00:32:15.000000000 +0000 ++++ agent/mibgroup/mibII/mibII_common.h 2010-03-12 00:33:59.000000000 +0000 +@@ -100,6 +100,9 @@ + #ifdef linux + #include "kernel_linux.h" + #endif ++#ifdef netbsd4 ++#include "kernel_netbsd.h" ++#endif + /* or MIB_xxxCOUNTER_SYMBOL || hpux11 */ + #ifdef hpux + #include <sys/mib.h> diff --git a/net/net-snmp/patches/patch-ey b/net/net-snmp/patches/patch-ey new file mode 100644 index 00000000000..ab2cfe0b085 --- /dev/null +++ b/net/net-snmp/patches/patch-ey @@ -0,0 +1,39 @@ +$NetBSD: patch-ey,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/tcp.c.orig 2010-03-12 00:32:22.000000000 +0000 ++++ agent/mibgroup/mibII/tcp.c 2010-03-12 00:34:09.000000000 +0000 +@@ -167,6 +167,12 @@ + #define USES_SNMP_DESIGNED_TCPSTAT + #endif + ++#ifdef netbsd4 ++#define TCP_STAT_STRUCTURE struct tcp_mib ++#define USES_SNMP_DESIGNED_TCPSTAT ++#undef TCP_NSTATS ++#endif ++ + #if defined (WIN32) || defined (cygwin) + #include <iphlpapi.h> + #define TCP_STAT_STRUCTURE MIB_TCPSTATS +@@ -768,6 +774,21 @@ + } + return ret_value; + } ++#elif defined(netbsd4) ++int ++tcp_load(netsnmp_cache *cache, void *vmagic) ++{ ++ long ret_value = -1; ++ ++ ret_value = netbsd_read_tcp_stat(&tcpstat); ++ ++ if ( ret_value < 0 ) { ++ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (netbsd)\n")); ++ } else { ++ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (netbsd)\n")); ++ } ++ return ret_value; ++} + #elif defined (WIN32) || defined (cygwin) + int + tcp_load(netsnmp_cache *cache, void *vmagic) diff --git a/net/net-snmp/patches/patch-ez b/net/net-snmp/patches/patch-ez new file mode 100644 index 00000000000..8d5d89e0fad --- /dev/null +++ b/net/net-snmp/patches/patch-ez @@ -0,0 +1,50 @@ +$NetBSD: patch-ez,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/udp.c.orig 2010-03-12 00:32:31.000000000 +0000 ++++ agent/mibgroup/mibII/udp.c 2010-03-12 00:34:17.000000000 +0000 +@@ -29,6 +29,10 @@ + #include "kernel_linux.h" + #endif + ++#ifdef netbsd4 ++#include "kernel_netbsd.h" ++#endif ++ + #ifdef cygwin + #define WIN32 + #include <windows.h> +@@ -149,6 +153,12 @@ + #define USES_SNMP_DESIGNED_UDPSTAT + #endif + ++#ifdef netbsd4 ++#define UDP_STAT_STRUCTURE struct udp_mib ++#define USES_SNMP_DESIGNED_UDPSTAT ++#undef UDP_NSTATS ++#endif ++ + #ifdef WIN32 + #include <iphlpapi.h> + #define UDP_STAT_STRUCTURE MIB_UDPSTATS +@@ -469,6 +479,21 @@ + } + return ret_value; + } ++#elif defined(netbsd4) ++int ++udp_load(netsnmp_cache *cache, void *vmagic) ++{ ++ long ret_value = -1; ++ ++ ret_value = netbsd_read_udp_stat(&udpstat); ++ ++ if ( ret_value < 0 ) { ++ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (netbsd)\n")); ++ } else { ++ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (netbsd)\n")); ++ } ++ return ret_value; ++} + #elif defined(WIN32) + int + udp_load(netsnmp_cache *cache, void *vmagic) diff --git a/net/net-snmp/patches/patch-fa b/net/net-snmp/patches/patch-fa new file mode 100644 index 00000000000..33a69ce6339 --- /dev/null +++ b/net/net-snmp/patches/patch-fa @@ -0,0 +1,14 @@ +$NetBSD: patch-fa,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- include/net-snmp/system/netbsd.h.orig 2010-03-12 00:32:48.000000000 +0000 ++++ include/net-snmp/system/netbsd.h 2010-03-12 00:34:40.000000000 +0000 +@@ -38,5 +38,9 @@ + # define netbsd1 netbsd1 + #endif + ++#if __NetBSD_Version__ >= 400000000 ++#define netbsd4 netbsd4 ++#endif /* __NetBSD_Version__ >= 400000000 */ ++ + /* define the extra mib modules that are supported */ + #define NETSNMP_INCLUDE_HOST_RESOURCES diff --git a/net/net-snmp/patches/patch-fb b/net/net-snmp/patches/patch-fb new file mode 100644 index 00000000000..a3210d97274 --- /dev/null +++ b/net/net-snmp/patches/patch-fb @@ -0,0 +1,13 @@ +$NetBSD: patch-fb,v 1.1 2010/05/11 04:39:54 adam Exp $ + +--- agent/mibgroup/mibII/ip.h 2010-03-12 00:54:04.000000000 +0000 ++++ agent/mibgroup/mibII/ip.h.orig 2010-03-12 00:53:16.000000000 +0000 +@@ -14,6 +14,8 @@ + + config_arch_require(solaris2, kernel_sunos5) + config_arch_require(linux, mibII/kernel_linux) ++config_arch_require(netbsd, mibII/kernel_netbsd) ++config_arch_require(netbsdelf, mibII/kernel_netbsd) + + #include "var_route.h" + #include "route_write.h" |