Update to 5.7.2.
This is a major update in terms of pkgsrc patches, of which there are far far too many. Analysis of patches was done by Karen Sirois of BBN, and I have remvoed patches that have been applied upstream. This builds fine and passes tests on NetBSD 6 i386. If you look after some other platform (Dragonfly, Darwin, FreeBSD, etc.), please make sure any problems are filed as upstream tickets; pkgsrc is not appropriate to carry patches long-term that should be fixed upstream, and this package has gotten out of hand. (OK by adam@ to do the update, but he has not reviewed the changes, so errors are my fault. It's quite likely there are issues on other platforms.) Upstream NEWS: *5.7.2* snmp: - BUG: 3526549: CVE-2012-2141 Array index error leading to crash snmpd: - BUG: 3532090: Fix high ifIndex values crashing hrDeviceDescr building: - PATCH: 2091156: correctly declare dependencies in Makefile. 'make -j <N>' should work now. Backport this to V5-4 as it is needed for correct operation in the single threaded case of make miblib as well. Many other miscellaneous minor bug fixes *5.7.1* libnetsnmp: - Fixed the mib-parsing-bug introduced shortly before 5.7 agent: - fixed rounding errors for disk percentage calculations openbsd: - better support for recent openbsd releases features: - bug fixes with minimalist support after additional user feedback Many other miscellaneous minor bug fixes *5.7* snmpd: - Delivery of data via regularily scheduled notifications. (see "Data Delivery via Notfications" in snmpd.conf) - Many time-based config options can take (m)ins, (h)ours, ... arguments (see the snmpd.conf manual page) - The PING and TRACEROUTE MIBs now compile and work-ish on linux http://www.net-snmp.org/wiki/index.php/DISMAN - Mib handlers can now implement a data_clone function for cloning the myvoid structure variable to avoid dangling pointers - Fixed persistent storage of VACM MIB configuration - Multi-homed agents send UDP responses from the proper IP address - The hrStorageTable implementation now supports large filesystems better - optimizations for large route tables - Added a deliveryByNotify config token for regular data delivery (see the snmpd.conf manual page and the NET-SNMP-PERIODIC-NOTIFY-MIB) - [PATCH 3141462]: fix agentx subagent issues with multiple-object requests - [PATCH 3057093]: linux uses libpci for creating useful ifDescr strings - [PATCH 3131397]: huge speedups of the TCP/UDP Tables libnetsnmp: - Removed the older CMU compatibility support - The SSH transport is now configurable TLS/DTLS support: - The SNMP over DTLS transport now properly supports IPv6 - Introduced new configuration tokens: localCert/peerCert (deprecating serverCert, clientCert, defX509ServerPub, defX509ClientPub) - Various fixes for the TLS/DTLS transports apps: - Added a per-variable timed output support to snmpwalk using -CT - snmpinform now correctly uses the local engineID for informs - A number of mib2c bug fixes - New snmp.conf tokens for timeouts and retries building: - New flags to reduce the amount of compiled code to bare minimums. This is provided by a new generic feature marking/selection mechanism. http://www.net-snmp.org/wiki/index.php/Feature_Marking_and_Selection - It's now possible to build without SNMPv3/USM (e.g., if you only want TLS/DTLS with SNMPv3/TSM) - It's possible to build the suite with no SET support configure using --enable-read-only - It's possible to build the agent as a notify-only agent configure using --enable-notify-only - Added a script to test memory usage with various config options (see the local/minimalist/sizetests script) - Net-SNMP can now be built to perform local DNSSEC validation (install DNSSEC-Tools' libval and use --with-local-dnssec-validation) testing: - a number of new API unit-tests have been added to the suite (to run the tests: cd testing && ./RUNFULLTESTS -g unit-tests) - The unit tests can be more easily run under valgrind (See http://bit.ly/jsgRnv for details) openbsd: - Support for updating the routing table via SNMP win32: - The testing suite works better under win32 environments - Many building fixes for the win32 environment(s) solaris: - Net-SNMP now supports the SCTP-MIB DragonFlyBSD, FreeBSD8: - Net-SNMP should now work on DragonFlyBSD and FreeBSD8 And of course: - Many other bug fixes. See the CHANGES and ChangeLog for details.
This commit is contained in:
parent
6fb17ee5a9
commit
aecf814b67
53 changed files with 134 additions and 2599 deletions
|
@ -1,7 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.94 2013/02/06 23:23:19 jperkin Exp $
|
||||
# $NetBSD: Makefile,v 1.95 2013/03/17 00:15:28 gdt Exp $
|
||||
|
||||
DISTNAME= net-snmp-5.6.1.1
|
||||
PKGREVISION= 6
|
||||
DISTNAME= net-snmp-5.7.2
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=net-snmp/}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@comment $NetBSD: PLIST,v 1.22 2011/06/24 09:46:10 adam Exp $
|
||||
@comment $NetBSD: PLIST,v 1.23 2013/03/17 00:15:28 gdt Exp $
|
||||
bin/agentxtrap
|
||||
bin/encode_keychange
|
||||
${PLIST.perl}bin/fixproc
|
||||
|
@ -66,6 +66,7 @@ include/net-snmp/agent/snmp_get_statistic.h
|
|||
include/net-snmp/agent/snmp_vars.h
|
||||
include/net-snmp/agent/stash_cache.h
|
||||
include/net-snmp/agent/stash_to_next.h
|
||||
include/net-snmp/agent/struct.h
|
||||
include/net-snmp/agent/sysORTable.h
|
||||
include/net-snmp/agent/table.h
|
||||
include/net-snmp/agent/table_array.h
|
||||
|
@ -75,6 +76,9 @@ include/net-snmp/agent/table_dataset.h
|
|||
include/net-snmp/agent/table_iterator.h
|
||||
include/net-snmp/agent/table_tdata.h
|
||||
include/net-snmp/agent/util_funcs.h
|
||||
include/net-snmp/agent/util_funcs/MIB_STATS_CACHE_TIMEOUT.h
|
||||
include/net-snmp/agent/util_funcs/header_generic.h
|
||||
include/net-snmp/agent/util_funcs/header_simple_table.h
|
||||
include/net-snmp/agent/var_struct.h
|
||||
include/net-snmp/agent/watcher.h
|
||||
include/net-snmp/config_api.h
|
||||
|
@ -84,7 +88,6 @@ include/net-snmp/library/asn1.h
|
|||
include/net-snmp/library/callback.h
|
||||
include/net-snmp/library/cert_util.h
|
||||
include/net-snmp/library/check_varbind.h
|
||||
include/net-snmp/library/cmu_compat.h
|
||||
include/net-snmp/library/container.h
|
||||
include/net-snmp/library/container_binary_array.h
|
||||
include/net-snmp/library/container_iterator.h
|
||||
|
@ -121,8 +124,8 @@ include/net-snmp/library/snmpTCPDomain.h
|
|||
${PLIST.inet6}include/net-snmp/library/snmpTCPIPv6Domain.h
|
||||
include/net-snmp/library/snmpUDPBaseDomain.h
|
||||
include/net-snmp/library/snmpUDPDomain.h
|
||||
${PLIST.inet6}include/net-snmp/library/snmpUDPIPv6Domain.h
|
||||
include/net-snmp/library/snmpUDPIPv4BaseDomain.h
|
||||
${PLIST.inet6}include/net-snmp/library/snmpUDPIPv6Domain.h
|
||||
include/net-snmp/library/snmpUnixDomain.h
|
||||
include/net-snmp/library/snmp_alarm.h
|
||||
include/net-snmp/library/snmp_api.h
|
||||
|
@ -151,6 +154,7 @@ include/net-snmp/library/winservice.h
|
|||
include/net-snmp/machine/generic.h
|
||||
include/net-snmp/mib_api.h
|
||||
include/net-snmp/net-snmp-config.h
|
||||
include/net-snmp/net-snmp-features.h
|
||||
include/net-snmp/net-snmp-includes.h
|
||||
include/net-snmp/output_api.h
|
||||
include/net-snmp/pdu_api.h
|
||||
|
@ -170,11 +174,15 @@ include/net-snmp/system/darwin9.h
|
|||
include/net-snmp/system/dragonfly.h
|
||||
include/net-snmp/system/dynix.h
|
||||
include/net-snmp/system/freebsd.h
|
||||
include/net-snmp/system/freebsd10.h
|
||||
include/net-snmp/system/freebsd2.h
|
||||
include/net-snmp/system/freebsd3.h
|
||||
include/net-snmp/system/freebsd4.h
|
||||
include/net-snmp/system/freebsd5.h
|
||||
include/net-snmp/system/freebsd6.h
|
||||
include/net-snmp/system/freebsd7.h
|
||||
include/net-snmp/system/freebsd8.h
|
||||
include/net-snmp/system/freebsd9.h
|
||||
include/net-snmp/system/generic.h
|
||||
include/net-snmp/system/hpux.h
|
||||
include/net-snmp/system/irix.h
|
||||
|
@ -183,6 +191,8 @@ include/net-snmp/system/mingw32.h
|
|||
include/net-snmp/system/mips.h
|
||||
include/net-snmp/system/netbsd.h
|
||||
include/net-snmp/system/openbsd.h
|
||||
include/net-snmp/system/openbsd4.h
|
||||
include/net-snmp/system/openbsd5.h
|
||||
include/net-snmp/system/osf5.h
|
||||
include/net-snmp/system/solaris.h
|
||||
include/net-snmp/system/solaris2.3.h
|
||||
|
@ -387,6 +397,7 @@ ${PLIST.perl}share/snmp/mib2c-data/generic-ctx-get.m2i
|
|||
${PLIST.perl}share/snmp/mib2c-data/generic-ctx-set.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-data-allocate.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-data-context.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-get-U64.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-get-char.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-get-decl-bot.m2i
|
||||
${PLIST.perl}share/snmp/mib2c-data/generic-get-decl.m2i
|
||||
|
@ -483,6 +494,7 @@ share/snmp/mibs/IF-MIB.txt
|
|||
share/snmp/mibs/INET-ADDRESS-MIB.txt
|
||||
share/snmp/mibs/IP-FORWARD-MIB.txt
|
||||
share/snmp/mibs/IP-MIB.txt
|
||||
share/snmp/mibs/IPV6-FLOW-LABEL-MIB.txt
|
||||
share/snmp/mibs/IPV6-ICMP-MIB.txt
|
||||
share/snmp/mibs/IPV6-MIB.txt
|
||||
share/snmp/mibs/IPV6-TC.txt
|
||||
|
@ -519,6 +531,7 @@ share/snmp/mibs/SNMPv2-TC.txt
|
|||
share/snmp/mibs/SNMPv2-TM.txt
|
||||
share/snmp/mibs/TCP-MIB.txt
|
||||
share/snmp/mibs/TRANSPORT-ADDRESS-MIB.txt
|
||||
share/snmp/mibs/TUNNEL-MIB.txt
|
||||
share/snmp/mibs/UCD-DEMO-MIB.txt
|
||||
share/snmp/mibs/UCD-DISKIO-MIB.txt
|
||||
share/snmp/mibs/UCD-DLMOD-MIB.txt
|
||||
|
|
|
@ -1,56 +1,25 @@
|
|||
$NetBSD: distinfo,v 1.69 2013/03/12 17:14:48 kim Exp $
|
||||
$NetBSD: distinfo,v 1.70 2013/03/17 00:15:28 gdt Exp $
|
||||
|
||||
SHA1 (net-snmp-5.6.1.1.tar.gz) = ec88ba3e0dff4d1b3d342ccebb48ea84c9fa6fa9
|
||||
RMD160 (net-snmp-5.6.1.1.tar.gz) = 9a4a83f7fe9431a0694b5fee33866ccea80fcab4
|
||||
Size (net-snmp-5.6.1.1.tar.gz) = 5937279 bytes
|
||||
SHA1 (patch-aa) = 699f6a6770c51c8976d8ec352ad213893e749032
|
||||
SHA1 (patch-ab) = d23ddbce52b54462ea2f7c695533a41eaf0046ee
|
||||
SHA1 (patch-ac) = f947f2fb88cee7bf92b5aa8cfe94ade079df1a66
|
||||
SHA1 (patch-ae) = 54541bffecdbf4c526280bc82ffd370a59963d88
|
||||
SHA1 (patch-af) = d7641e502fd0a2969fa838fc67244cdfc6995369
|
||||
SHA1 (patch-ag) = 8f9dedcf741c4b0ea2c0150c8b0a22747ca8a313
|
||||
SHA1 (patch-agent_mibgroup_agent_extend.c) = b3b04c51e7059426963fdb4712a711e2da053a28
|
||||
SHA1 (patch-agent_mibgroup_host_data__access_swrun__kinfo.c) = ef82011e34f61e0bd606ee497647a605d9c81d23
|
||||
SHA1 (patch-agent_mibgroup_mibII_ipAddr.c) = 1dc4f353d042fe8ceb31ab2ad66a7661790ac458
|
||||
SHA1 (patch-ah) = 7cea4194c858d7a8a9093eaf4426404e9202c3f1
|
||||
SHA1 (patch-ai) = 1eb3b72dcfff90c8e973590265bdb1c07b717eaa
|
||||
SHA1 (patch-aj) = e3337d01e96cc0739dbf3b1c7bde44d1126c32ae
|
||||
SHA1 (patch-ak) = 8a7b26b29dcce292355c8239d6b5a2b9fe0b3253
|
||||
SHA1 (patch-al) = 468394dc540329449c074a6f19ab3e0287041607
|
||||
SHA1 (patch-am) = db771145f72a043beeb589e450617e42ca5d5c00
|
||||
SHA1 (patch-an) = 6f47b44697f22d322e35b83d47aa5f7383a8c7cd
|
||||
SHA1 (patch-ao) = 989b410de3a28c37a50581a6f8d109f448b2b421
|
||||
SHA1 (patch-ap) = 36032fefe04671a0a5f7db765bdd2115963d01f1
|
||||
SHA1 (patch-aq) = b639bceac59a987ec779fe472fa4e97aa7b24204
|
||||
SHA1 (patch-da) = 7466445c8388492344acdee236b153cb5f5b45e1
|
||||
SHA1 (patch-db) = bec0bee1860ee42ba64b4c07df2280e206eaf582
|
||||
SHA1 (patch-dc) = f84beba7fae731bb0e38b9635dd2f7009c3659aa
|
||||
SHA1 (patch-dd) = 08da0d1da485959549ac461e5cbb7030f800e643
|
||||
SHA1 (patch-de) = 532045f8e509b4df0acc46bf5e778d10d3b36012
|
||||
SHA1 (patch-df) = 8851ce05e61345496d2abe65cac2896268d72624
|
||||
SHA1 (patch-dg) = 6e6e396add0613dd76e3b8618008a7ebf8103c7c
|
||||
SHA1 (patch-dh) = 41530526190fb9a0419db1c604c2ac6025417706
|
||||
SHA1 (patch-di) = e0e1039c1adbf10ae56c50998ff74b39193e7348
|
||||
SHA1 (patch-dl) = 0619c8c9fc2e382a57fc127fa6bc52121d2bf288
|
||||
SHA1 (patch-dm) = 5c990fb3286453534d9c02fa1ab6eda76abd9d33
|
||||
SHA1 (patch-dn) = 1410274fc6774e4aa043485a21b97c3b644c46b7
|
||||
SHA1 (patch-do) = 5144514d78c5cdd1f289749fc958e0d491c9ba98
|
||||
SHA1 (patch-dp) = 3ecdfa78a5c7a86715d3fd3ab8bbd0208a0d685d
|
||||
SHA1 (patch-dq) = 75d25b51db74151e4956498c9730006b8ff57992
|
||||
SHA1 (patch-dr) = 6a0c80e2edea934917939c2745bf86e2e7142bf5
|
||||
SHA1 (patch-ds) = 3fbd86bffb76cbf11bc8c958320dc669c1b750ec
|
||||
SHA1 (patch-dt) = 33036d099682ba9882b9ffe73ee25a8d626bdbaa
|
||||
SHA1 (patch-du) = c3c053c95c24c3fecfdcb7dfe649168a866206ba
|
||||
SHA1 (patch-el) = f32d387045854686d9fc036de7d884cf889134ae
|
||||
SHA1 (patch-es) = 222de078a45ae2e80a3903342916783aec43cc43
|
||||
SHA1 (patch-et) = 5cb3d9c96e78b9f3e85ef3c5af96059cca865762
|
||||
SHA1 (patch-eu) = 606d9952dc9a994d8058004d5ba411c3c9dddcec
|
||||
SHA1 (patch-ev) = 966e9686d826e530323baad5a10e6bd251a08526
|
||||
SHA1 (patch-ew) = 503c4db9c3e784a16854a6b5aa40a79798f2e381
|
||||
SHA1 (patch-ex) = 911c5ca0186ef806f0ffb9e7cfbc0e14f79d9e62
|
||||
SHA1 (patch-ey) = b96fd2f4abb53bc1233753623128fe2e7f99089c
|
||||
SHA1 (patch-ez) = a2d8ed3f0895b1f5908b8f311ad86dd79a7ffe04
|
||||
SHA1 (patch-fa) = f0102bf99b003b143fa3279e2187616b89e3b678
|
||||
SHA1 (patch-fb) = 64d97a51d82488ef4d3ea5dd40278501975d58fb
|
||||
SHA1 (patch-fc) = 4e0b9841cbff0da02748efc9105096ffcbe58e81
|
||||
SHA1 (patch-fd) = efab8fe5cb1e6bdc7799dbdfd27e88d734d843ad
|
||||
SHA1 (net-snmp-5.7.2.tar.gz) = c493027907f32400648244d81117a126aecd27ee
|
||||
RMD160 (net-snmp-5.7.2.tar.gz) = 392d643e9f2f42ee4fa688b4702329ad005ee12e
|
||||
Size (net-snmp-5.7.2.tar.gz) = 6281352 bytes
|
||||
SHA1 (patch-ac) = 59987ecb9467b1cead9af3d4432a4dd69be93480
|
||||
SHA1 (patch-af) = 4fb96b79f9126dedb8a132d44894ea23c9e8c101
|
||||
SHA1 (patch-ag) = d9595eceeb5ee986ab4365f62e3c3ab339e605aa
|
||||
SHA1 (patch-agent_mibgroup_hardware_memory_memory__netbsd.c) = fe812fa13dffb4c3716d008381211dda9746c11e
|
||||
SHA1 (patch-agent_mibgroup_host_data__access_swrun__kinfo.c) = 054866e7c3ac90f183fd4a6d53763a5bba50572c
|
||||
SHA1 (patch-agent_mibgroup_mibII_ipAddr.c) = cd3345a4b30fe2280d0555ee38feb5f957a55b1e
|
||||
SHA1 (patch-ai) = 04c2a487bad8705c9725ef4a62016051d3898970
|
||||
SHA1 (patch-aj) = d110e996d0538d17251d39a5eed46df6944ba0fa
|
||||
SHA1 (patch-ak) = 50ac67db8a9ffc16d983b4192e74db25ef439321
|
||||
SHA1 (patch-am) = 85bd52b707e5693ae3c26de7ccd9f8fa3a91263b
|
||||
SHA1 (patch-ap) = 44a4ce6302457094ba2b200e4c47ff6c2a425746
|
||||
SHA1 (patch-aq) = a8fe703d8902c2847ca6692af4400ddbf9cbe74b
|
||||
SHA1 (patch-da) = 40e8d78bad93ca12f4c08c43b86e7f13edafc299
|
||||
SHA1 (patch-db) = 281be9a88860987880c71770f4050fd965dd8ed9
|
||||
SHA1 (patch-dl) = 92563fd6be6f27be5b348cdc8bc02061374026b0
|
||||
SHA1 (patch-dt) = 452fee78b37f8ce0eb30049f9f18b04cff9b6e6e
|
||||
SHA1 (patch-du) = 89a77e82d881207500fb45c422b66710e44c0eb4
|
||||
SHA1 (patch-el) = b85dbef28e14fe29c9fb944508a08e7423a37152
|
||||
SHA1 (patch-es) = 7336d905bac315f344f93664e4118332f88fb6ee
|
||||
SHA1 (patch-fa) = 8fd68fb2107ca6268a149e633ec3b9184daca043
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-aa,v 1.9 2011/05/27 10:55:24 adam Exp $
|
||||
|
||||
--- agent/mibgroup/host/hr_filesys.c.orig 2008-07-30 11:58:30.000000000 +0200
|
||||
+++ agent/mibgroup/host/hr_filesys.c
|
||||
@@ -111,6 +111,11 @@ struct mnttab *HRFS_entry = &HRFS_entry
|
||||
|
||||
#elif defined(HAVE_STATVFS) && defined(__NetBSD__)
|
||||
|
||||
+#if !defined(MFSNAMELEN) && defined(_VFS_NAMELEN)
|
||||
+#define MFSNAMELEN _VFS_NAMELEN
|
||||
+#endif
|
||||
+
|
||||
+#define getfsstat getvfsstat
|
||||
static struct statvfs *fsstats = NULL;
|
||||
struct statvfs *HRFS_entry;
|
||||
static int fscount;
|
|
@ -1,160 +0,0 @@
|
|||
$NetBSD: patch-ab,v 1.11 2011/05/27 10:55:24 adam Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/diskio.c.orig 2009-04-10 20:14:51.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/diskio.c
|
||||
@@ -446,6 +446,155 @@ var_diskio(struct variable * vp,
|
||||
}
|
||||
#endif /* bsdi */
|
||||
|
||||
+#ifdef __NetBSD__
|
||||
+#include <sys/sysctl.h>
|
||||
+static int ndisk;
|
||||
+#ifdef HW_IOSTATNAMES
|
||||
+static int nmib[2] = {CTL_HW, HW_IOSTATNAMES};
|
||||
+#else
|
||||
+static int nmib[2] = {CTL_HW, HW_DISKNAMES};
|
||||
+#endif
|
||||
+#ifdef HW_DISKSTATS
|
||||
+#include <sys/disk.h>
|
||||
+static int dmib[3] = {CTL_HW, HW_DISKSTATS, sizeof(struct disk_sysctl)};
|
||||
+static struct disk_sysctl *dk;
|
||||
+#endif
|
||||
+#ifdef HW_IOSTATS
|
||||
+#include <sys/iostat.h>
|
||||
+static int dmib[3] = {CTL_HW, HW_IOSTATS, sizeof(struct io_sysctl)};
|
||||
+static struct io_sysctl *dk;
|
||||
+#endif
|
||||
+static char **dkname;
|
||||
+
|
||||
+static int
|
||||
+getstats(void)
|
||||
+{
|
||||
+ time_t now;
|
||||
+ char *t, *tp;
|
||||
+ int size, dkn_size, i;
|
||||
+
|
||||
+ now = time(NULL);
|
||||
+ if (cache_time + CACHE_TIMEOUT > now) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+ size = 0;
|
||||
+ if (sysctl(dmib, 3, NULL, &size, NULL, 0) < 0) {
|
||||
+ perror("Can't get size of HW_DISKSTATS/HW_IOSTATS mib");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (ndisk != size / dmib[2]) {
|
||||
+ if (dk)
|
||||
+ free(dk);
|
||||
+ if (dkname) {
|
||||
+ for (i = 0; i < ndisk; i++)
|
||||
+ if (dkname[i])
|
||||
+ free(dkname[i]);
|
||||
+ free(dkname);
|
||||
+ }
|
||||
+ ndisk = size / dmib[2];
|
||||
+ if (ndisk == 0)
|
||||
+ return 0;
|
||||
+ dkname = malloc(ndisk * sizeof(char *));
|
||||
+ if (sysctl(nmib, 2, NULL, &dkn_size, NULL, 0) < 0) {
|
||||
+ perror("Can't get size of HW_DISKNAMES mib");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ t = malloc(dkn_size);
|
||||
+ if (sysctl(nmib, 2, t, &dkn_size, NULL, 0) < 0) {
|
||||
+ perror("Can't get size of HW_DISKNAMES mib");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ for (i = 0, tp = strtok(t, " "); tp && i < ndisk; i++,
|
||||
+ tp = strtok(NULL, " ")) {
|
||||
+ dkname[i] = strdup(tp);
|
||||
+ }
|
||||
+ free(t);
|
||||
+ dk = malloc(ndisk * sizeof(*dk));
|
||||
+ }
|
||||
+ if (sysctl(dmib, 3, dk, &size, NULL, 0) < 0) {
|
||||
+ perror("Can't get HW_DISKSTATS/HW_IOSTATS mib");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ cache_time = now;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+u_char *
|
||||
+var_diskio(struct variable * vp,
|
||||
+ oid * name,
|
||||
+ size_t * length,
|
||||
+ int exact, size_t * var_len, WriteMethod ** write_method)
|
||||
+{
|
||||
+ static long long_ret;
|
||||
+ unsigned int indx;
|
||||
+
|
||||
+ if (getstats() == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (header_simple_table
|
||||
+ (vp, name, length, exact, var_len, write_method, ndisk))
|
||||
+ return NULL;
|
||||
+
|
||||
+ indx = (unsigned int) (name[*length - 1] - 1);
|
||||
+ if (indx >= ndisk)
|
||||
+ return NULL;
|
||||
+
|
||||
+ switch (vp->magic) {
|
||||
+ case DISKIO_INDEX:
|
||||
+ long_ret = (long) indx + 1;
|
||||
+ return (u_char *) & long_ret;
|
||||
+
|
||||
+ case DISKIO_DEVICE:
|
||||
+ *var_len = strlen(dkname[indx]);
|
||||
+ return (u_char *) dkname[indx];
|
||||
+
|
||||
+ case DISKIO_NREAD:
|
||||
+#ifdef HW_DISKSTATS
|
||||
+ long_ret = dk[indx].dk_rbytes;
|
||||
+#endif
|
||||
+#ifdef HW_IOSTATS
|
||||
+ if (dk[indx].type == IOSTAT_DISK)
|
||||
+ long_ret = dk[indx].rbytes;
|
||||
+#endif
|
||||
+ return (u_char *) & long_ret;
|
||||
+
|
||||
+ case DISKIO_NWRITTEN:
|
||||
+#ifdef HW_DISKSTATS
|
||||
+ long_ret = dk[indx].dk_wbytes;
|
||||
+#endif
|
||||
+#ifdef HW_IOSTATS
|
||||
+ if (dk[indx].type == IOSTAT_DISK)
|
||||
+ long_ret = dk[indx].wbytes;
|
||||
+#endif
|
||||
+ return (u_char *) & long_ret;
|
||||
+
|
||||
+ case DISKIO_READS:
|
||||
+#ifdef HW_DISKSTATS
|
||||
+ long_ret = dk[indx].dk_rxfer;
|
||||
+#endif
|
||||
+#ifdef HW_IOSTATS
|
||||
+ if (dk[indx].type == IOSTAT_DISK)
|
||||
+ long_ret = dk[indx].rxfer;
|
||||
+#endif
|
||||
+ return (u_char *) & long_ret;
|
||||
+
|
||||
+ case DISKIO_WRITES:
|
||||
+#ifdef HW_DISKSTATS
|
||||
+ long_ret = dk[indx].dk_wxfer;
|
||||
+#endif
|
||||
+#ifdef HW_IOSTATS
|
||||
+ if (dk[indx].type == IOSTAT_DISK)
|
||||
+ long_ret = dk[indx].wxfer;
|
||||
+#endif
|
||||
+ return (u_char *) & long_ret;
|
||||
+
|
||||
+ default:
|
||||
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+#endif /* __NetBSD__ */
|
||||
+
|
||||
#if defined(freebsd4) || defined(freebsd5)
|
||||
|
||||
/* disk load average patch by Rojer */
|
|
@ -1,13 +1,14 @@
|
|||
$NetBSD: patch-ac,v 1.11 2011/05/30 08:58:33 adam Exp $
|
||||
$NetBSD: patch-ac,v 1.12 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/if-mib/data_access/interface.h.orig 2011-02-04 12:47:44.000000000 +0000
|
||||
--- agent/mibgroup/if-mib/data_access/interface.h.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/if-mib/data_access/interface.h
|
||||
@@ -36,7 +36,7 @@ config_exclude(mibII/interfaces)
|
||||
config_require(if-mib/data_access/interface_linux)
|
||||
config_require(if-mib/data_access/interface_ioctl)
|
||||
@@ -38,7 +38,8 @@ config_exclude(mibII/interfaces)
|
||||
|
||||
-# elif defined( openbsd3 ) || defined( openbsd4 ) || \
|
||||
+# elif defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2) || defined(netbsdelf3) || defined( openbsd3 ) || defined( openbsd4 ) || \
|
||||
defined( freebsd4 ) || defined( freebsd5 ) || defined( freebsd6 ) || defined (darwin)
|
||||
# elif defined( openbsd3 ) || \
|
||||
defined( freebsd4 ) || defined( freebsd5 ) || defined( freebsd6 ) || \
|
||||
- defined( darwin ) || defined( dragonfly ) || defined( netbsd1 )
|
||||
+ defined( darwin ) || defined( dragonfly ) || defined( netbsd1 ) || \
|
||||
+ defined(netbsd) || defined(netbsdelf) || defined(netbsdelf2) || defined(netbsdelf3)
|
||||
|
||||
config_require(if-mib/data_access/interface_sysctl)
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
$NetBSD: patch-ae,v 1.7 2011/05/27 10:55:24 adam Exp $
|
||||
|
||||
--- snmplib/transports/snmpUDPIPv6Domain.c.orig 2010-04-28 07:29:33.000000000 +0000
|
||||
+++ snmplib/transports/snmpUDPIPv6Domain.c
|
||||
@@ -54,6 +54,10 @@ const struct in6_addr in6addr_any = IN6A
|
||||
#define SS_FAMILY __ss_family
|
||||
#endif
|
||||
|
||||
+#if defined(darwin)
|
||||
+#include <stdint.h> /* for uint8_t */
|
||||
+#endif
|
||||
+
|
||||
#include <net-snmp/types.h>
|
||||
#include <net-snmp/output_api.h>
|
||||
#include <net-snmp/config_api.h>
|
|
@ -1,28 +1,8 @@
|
|||
$NetBSD: patch-af,v 1.15 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-af,v 1.16 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- configure.orig 2011-01-03 23:31:36.000000000 +0000
|
||||
--- configure.orig 2012-10-09 22:35:37.000000000 +0000
|
||||
+++ configure
|
||||
@@ -19162,6 +19162,9 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#if HAVE_SYS_QUEUE_H
|
||||
#include <sys/queue.h>
|
||||
#endif
|
||||
+#if HAVE_NET_ROUTE_H
|
||||
+#include <net/route.h>
|
||||
+#endif
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
@@ -19259,6 +19262,9 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#if HAVE_NET_ROUTE_H
|
||||
#include <net/route.h>
|
||||
#endif
|
||||
+#if HAVE_NETINET_IP_H
|
||||
+#include <netinet/ip.h>
|
||||
+#endif
|
||||
|
||||
|
||||
#include <$ac_header>
|
||||
@@ -28917,6 +28923,81 @@ fi
|
||||
@@ -20981,6 +20981,81 @@ fi
|
||||
##
|
||||
#########################################
|
||||
|
||||
|
@ -104,390 +84,3 @@ $NetBSD: patch-af,v 1.15 2011/05/27 10:55:25 adam Exp $
|
|||
##
|
||||
# Compilation-related
|
||||
##
|
||||
@@ -37938,6 +38019,12 @@ char $ac_func ();
|
||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
||||
choke me
|
||||
#endif
|
||||
+#if HAVE_NET_IF_H
|
||||
+#include <net/if.h>
|
||||
+#endif
|
||||
+#if HAVE_NET_ROUTE_H
|
||||
+#include <net/route.h>
|
||||
+#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
@@ -47154,6 +47241,219 @@ _ACEOF
|
||||
|
||||
|
||||
fi
|
||||
+{ $as_echo "$as_me:$LINENO: checking for struct ifnet.if_lastchange.tv_nsec" >&5
|
||||
+$as_echo_n "checking for struct ifnet.if_lastchange.tv_nsec... " >&6; }
|
||||
+if test "${ac_cv_member_struct_ifnet_if_lastchange_tv_nsec+set}" = set; then
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ cat >conftest.$ac_ext <<_ACEOF
|
||||
+/* confdefs.h. */
|
||||
+_ACEOF
|
||||
+cat confdefs.h >>conftest.$ac_ext
|
||||
+cat >>conftest.$ac_ext <<_ACEOF
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
+#define _KERNEL 1
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_TYPES_H
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_SOCKET_H
|
||||
+#include <sys/socket.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_TIME_H
|
||||
+#include <sys/time.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_NET_IF_H
|
||||
+#include <net/if.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_NET_IF_VAR_H
|
||||
+#include <net/if_var.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_QUEUE_H
|
||||
+#include <sys/queue.h>
|
||||
+#endif
|
||||
+#ifdef linux
|
||||
+struct ifnet {
|
||||
+ char *if_name; /* name, e.g. "en" or "lo" */
|
||||
+ short if_unit; /* sub-unit for lower level driver */
|
||||
+ short if_mtu; /* maximum transmission unit */
|
||||
+ short if_flags; /* up/down, broadcast, etc. */
|
||||
+ int if_metric; /* routing metric (external only) */
|
||||
+ char if_hwaddr [6]; /* ethernet address */
|
||||
+ int if_type; /* interface type: 1=generic,
|
||||
+ 28=slip, ether=6, loopback=24 */
|
||||
+ int if_speed; /* interface speed: in bits/sec */
|
||||
+
|
||||
+ struct sockaddr if_addr; /* interface's address */
|
||||
+ struct sockaddr ifu_broadaddr; /* broadcast address */
|
||||
+ struct sockaddr ia_subnetmask; /* interface's mask */
|
||||
+
|
||||
+ struct ifqueue {
|
||||
+ int ifq_len;
|
||||
+ int ifq_drops;
|
||||
+ } if_snd; /* output queue */
|
||||
+ int if_ibytes; /* octets received on interface */
|
||||
+ int if_ipackets; /* packets received on interface */
|
||||
+ int if_ierrors; /* input errors on interface */
|
||||
+ int if_iqdrops; /* input queue overruns */
|
||||
+ int if_obytes; /* octets sent on interface */
|
||||
+ int if_opackets; /* packets sent on interface */
|
||||
+ int if_oerrors; /* output errors on interface */
|
||||
+ int if_collisions; /* collisions on csma interfaces */
|
||||
+/* end statistics */
|
||||
+ struct ifnet *if_next;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+static struct ifnet ac_aggr;
|
||||
+if (ac_aggr.if_lastchange.tv_nsec)
|
||||
+return 0;
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+rm -f conftest.$ac_objext
|
||||
+if { (ac_try="$ac_compile"
|
||||
+case "(($ac_try" in
|
||||
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
+ *) ac_try_echo=$ac_try;;
|
||||
+esac
|
||||
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
+$as_echo "$ac_try_echo") >&5
|
||||
+ (eval "$ac_compile") 2>conftest.er1
|
||||
+ ac_status=$?
|
||||
+ grep -v '^ *+' conftest.er1 >conftest.err
|
||||
+ rm -f conftest.er1
|
||||
+ cat conftest.err >&5
|
||||
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
+ (exit $ac_status); } && {
|
||||
+ test -z "$ac_c_werror_flag" ||
|
||||
+ test ! -s conftest.err
|
||||
+ } && test -s conftest.$ac_objext; then
|
||||
+ ac_cv_member_struct_ifnet_if_lastchange_tv_nsec=yes
|
||||
+else
|
||||
+ $as_echo "$as_me: failed program was:" >&5
|
||||
+sed 's/^/| /' conftest.$ac_ext >&5
|
||||
+
|
||||
+ cat >conftest.$ac_ext <<_ACEOF
|
||||
+/* confdefs.h. */
|
||||
+_ACEOF
|
||||
+cat confdefs.h >>conftest.$ac_ext
|
||||
+cat >>conftest.$ac_ext <<_ACEOF
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
+#define _KERNEL 1
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_TYPES_H
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_SOCKET_H
|
||||
+#include <sys/socket.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_TIME_H
|
||||
+#include <sys/time.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_NET_IF_H
|
||||
+#include <net/if.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_NET_IF_VAR_H
|
||||
+#include <net/if_var.h>
|
||||
+#endif
|
||||
+#ifdef HAVE_SYS_QUEUE_H
|
||||
+#include <sys/queue.h>
|
||||
+#endif
|
||||
+#ifdef linux
|
||||
+struct ifnet {
|
||||
+ char *if_name; /* name, e.g. "en" or "lo" */
|
||||
+ short if_unit; /* sub-unit for lower level driver */
|
||||
+ short if_mtu; /* maximum transmission unit */
|
||||
+ short if_flags; /* up/down, broadcast, etc. */
|
||||
+ int if_metric; /* routing metric (external only) */
|
||||
+ char if_hwaddr [6]; /* ethernet address */
|
||||
+ int if_type; /* interface type: 1=generic,
|
||||
+ 28=slip, ether=6, loopback=24 */
|
||||
+ int if_speed; /* interface speed: in bits/sec */
|
||||
+
|
||||
+ struct sockaddr if_addr; /* interface's address */
|
||||
+ struct sockaddr ifu_broadaddr; /* broadcast address */
|
||||
+ struct sockaddr ia_subnetmask; /* interface's mask */
|
||||
+
|
||||
+ struct ifqueue {
|
||||
+ int ifq_len;
|
||||
+ int ifq_drops;
|
||||
+ } if_snd; /* output queue */
|
||||
+ int if_ibytes; /* octets received on interface */
|
||||
+ int if_ipackets; /* packets received on interface */
|
||||
+ int if_ierrors; /* input errors on interface */
|
||||
+ int if_iqdrops; /* input queue overruns */
|
||||
+ int if_obytes; /* octets sent on interface */
|
||||
+ int if_opackets; /* packets sent on interface */
|
||||
+ int if_oerrors; /* output errors on interface */
|
||||
+ int if_collisions; /* collisions on csma interfaces */
|
||||
+/* end statistics */
|
||||
+ struct ifnet *if_next;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+static struct ifnet ac_aggr;
|
||||
+if (sizeof ac_aggr.if_lastchange.tv_nsec)
|
||||
+return 0;
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+rm -f conftest.$ac_objext
|
||||
+if { (ac_try="$ac_compile"
|
||||
+case "(($ac_try" in
|
||||
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
+ *) ac_try_echo=$ac_try;;
|
||||
+esac
|
||||
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
+$as_echo "$ac_try_echo") >&5
|
||||
+ (eval "$ac_compile") 2>conftest.er1
|
||||
+ ac_status=$?
|
||||
+ grep -v '^ *+' conftest.er1 >conftest.err
|
||||
+ rm -f conftest.er1
|
||||
+ cat conftest.err >&5
|
||||
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
+ (exit $ac_status); } && {
|
||||
+ test -z "$ac_c_werror_flag" ||
|
||||
+ test ! -s conftest.err
|
||||
+ } && test -s conftest.$ac_objext; then
|
||||
+ ac_cv_member_struct_ifnet_if_lastchange_tv_nsec=yes
|
||||
+else
|
||||
+ $as_echo "$as_me: failed program was:" >&5
|
||||
+sed 's/^/| /' conftest.$ac_ext >&5
|
||||
+
|
||||
+ ac_cv_member_struct_ifnet_if_lastchange_tv_nsec=no
|
||||
+fi
|
||||
+
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+fi
|
||||
+
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+fi
|
||||
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifnet_if_lastchange_tv_nsec" >&5
|
||||
+$as_echo "$ac_cv_member_struct_ifnet_if_lastchange_tv_nsec" >&6; }
|
||||
+if test "x$ac_cv_member_struct_ifnet_if_lastchange_tv_nsec" = x""yes; then
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_STRUCT_IFNET_IF_LASTCHANGE_TV_NSEC 1
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+fi
|
||||
{ $as_echo "$as_me:$LINENO: checking for struct ifnet.if_mtu" >&5
|
||||
$as_echo_n "checking for struct ifnet.if_mtu... " >&6; }
|
||||
if test "${ac_cv_member_struct_ifnet_if_mtu+set}" = set; then
|
||||
@@ -48674,8 +48974,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -48732,8 +49034,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -48813,8 +49117,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -48871,8 +49177,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -48952,8 +49260,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49010,8 +49320,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49091,8 +49403,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49149,8 +49463,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49230,8 +49546,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49288,8 +49606,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49369,8 +49689,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49427,8 +49749,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49516,8 +49840,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#include <sys/types.h>
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
@@ -49585,8 +49911,10 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#include <sys/types.h>
|
||||
#ifdef NETSNMP_IFNET_NEEDS_KERNEL
|
||||
#define KERNEL
|
||||
+#if !defined(__DragonFly__)
|
||||
#define _KERNEL
|
||||
#endif
|
||||
+#endif
|
||||
#include <sys/socket.h>
|
||||
#undef KERNEL
|
||||
#undef _KERNEL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-ag,v 1.11 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-ag,v 1.12 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/host/hr_storage.c.orig 2006-10-12 11:54:57.000000000 +0200
|
||||
--- agent/mibgroup/host/hr_storage.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/host/hr_storage.c
|
||||
@@ -69,6 +69,13 @@
|
||||
#endif
|
||||
|
@ -16,7 +16,7 @@ $NetBSD: patch-ag,v 1.11 2011/05/27 10:55:25 adam Exp $
|
|||
#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
|
||||
#include <uvm/uvm_param.h>
|
||||
#include <uvm/uvm_extern.h>
|
||||
@@ -82,20 +89,13 @@
|
||||
@@ -76,20 +83,13 @@
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/vm_extern.h>
|
||||
#endif
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
$NetBSD: patch-agent_mibgroup_agent_extend.c,v 1.1 2012/05/17 12:56:17 spz Exp $
|
||||
|
||||
patch by Jan Safranek <jsafranek@users.sourceforge.net> for CVE-2012-2141
|
||||
from https://bugzilla.redhat.com/attachment.cgi?id=580443 :
|
||||
|
||||
Check out-of-index conditions in ExtendOutput2Table.
|
||||
|
||||
--- agent/mibgroup/agent/extend.c.orig 2010-07-08 11:19:15.000000000 +0000
|
||||
+++ agent/mibgroup/agent/extend.c
|
||||
@@ -1309,6 +1309,10 @@ handle_nsExtendOutput2Table(netsnmp_mib_
|
||||
* Determine which line we've been asked for....
|
||||
*/
|
||||
line_idx = *table_info->indexes->next_variable->val.integer;
|
||||
+ if (line_idx < 1 || line_idx > extension->numlines) {
|
||||
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
|
||||
+ continue;
|
||||
+ }
|
||||
cp = extension->lines[line_idx-1];
|
||||
|
||||
/*
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-agent_mibgroup_host_data__access_swrun__kinfo.c,v 1.1 2013/01/11 13:34:46 joerg Exp $
|
||||
$NetBSD: patch-agent_mibgroup_host_data__access_swrun__kinfo.c,v 1.2 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/host/data_access/swrun_kinfo.c.orig 2013-01-11 11:01:25.000000000 +0000
|
||||
--- agent/mibgroup/host/data_access/swrun_kinfo.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/host/data_access/swrun_kinfo.c
|
||||
@@ -5,6 +5,10 @@
|
||||
*
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-agent_mibgroup_mibII_ipAddr.c,v 1.1 2013/03/12 17:14:49 kim Exp $
|
||||
$NetBSD: patch-agent_mibgroup_mibII_ipAddr.c,v 1.2 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/ipAddr.c.orig 2010-01-23 17:07:35.000000000 +0200
|
||||
+++ agent/mibgroup/mibII/ipAddr.c 2013-03-12 17:48:01.000000000 +0200
|
||||
@@ -218,6 +218,10 @@
|
||||
--- agent/mibgroup/mibII/ipAddr.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/ipAddr.c
|
||||
@@ -221,6 +221,10 @@ var_ipAddrEntry(struct variable *vp,
|
||||
if (Interface_Scan_Next(&interface, NULL, &ifnet, &in_ifaddr) == 0)
|
||||
break;
|
||||
#ifdef HAVE_STRUCT_IFNET_IF_ADDRLIST
|
||||
|
|
|
@ -1,142 +0,0 @@
|
|||
$NetBSD: patch-ah,v 1.6 2010/12/26 09:23:49 sekiya Exp $
|
||||
|
||||
--- agent/mibgroup/hardware/memory/memory_netbsd.c.orig 2006-03-07 01:23:52.000000000 +0900
|
||||
+++ agent/mibgroup/hardware/memory/memory_netbsd.c 2010-12-26 17:50:43.000000000 +0900
|
||||
@@ -4,7 +4,9 @@
|
||||
#include <net-snmp/agent/hardware/memory.h>
|
||||
|
||||
#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
#include <sys/sysctl.h>
|
||||
+#include <sys/vmmeter.h>
|
||||
#include <sys/swap.h>
|
||||
|
||||
#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
|
||||
@@ -30,27 +32,47 @@
|
||||
long pagesize;
|
||||
|
||||
struct uvmexp uvmexp;
|
||||
- int uvmexp_size = sizeof(uvmexp);
|
||||
- int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
|
||||
+ size_t uvmexp_size = sizeof(uvmexp);
|
||||
|
||||
struct vmtotal total;
|
||||
size_t total_size = sizeof(total);
|
||||
- int total_mib[] = { CTL_VM, VM_METER };
|
||||
|
||||
- long phys_mem;
|
||||
- long user_mem;
|
||||
+ quad_t phys_mem;
|
||||
+ quad_t user_mem;
|
||||
+ unsigned int bufspace;
|
||||
+ unsigned int maxbufspace;
|
||||
size_t mem_size = sizeof(phys_mem);
|
||||
- int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };
|
||||
- int user_mem_mib[] = { CTL_HW, HW_USERMEM };
|
||||
+ size_t buf_size = sizeof(bufspace);
|
||||
|
||||
/*
|
||||
* Retrieve the memory information from the underlying O/S...
|
||||
*/
|
||||
- sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
|
||||
- sysctl(total_mib, 2, &total, &total_size, NULL, 0);
|
||||
- sysctl(phys_mem_mib, 2, &phys_mem, &mem_size, NULL, 0);
|
||||
- sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0);
|
||||
- pagesize = uvmexp.pagesize;
|
||||
+ if (sysctlbyname("vm.uvmexp", &uvmexp, &uvmexp_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl vm.uvmexp failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (sysctlbyname("vm.vmmeter", &total, &total_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl vm.vmmeter failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (sysctlbyname("hw.physmem64", &phys_mem, &mem_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl hw.physmem64 failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (sysctlbyname("hw.usermem64", &user_mem, &mem_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl hw.usermem64 failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (sysctlbyname("vm.bufmem", &bufspace, &buf_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl vm.bufmem failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (sysctlbyname("vm.bufmem_hiwater", &maxbufspace, &buf_size, NULL, 0) == -1) {
|
||||
+ snmp_log(LOG_ERR, "sysctl vm.bufmem_hiwater failed (errno %d)\n", errno);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
/*
|
||||
* ... and save this in a standard form.
|
||||
@@ -64,7 +86,6 @@
|
||||
mem->units = pagesize;
|
||||
mem->size = phys_mem/pagesize;
|
||||
mem->free = total.t_free;
|
||||
- mem->other = -1;
|
||||
}
|
||||
|
||||
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
|
||||
@@ -76,7 +97,39 @@
|
||||
mem->units = pagesize;
|
||||
mem->size = user_mem/pagesize;
|
||||
mem->free = uvmexp.free;
|
||||
- mem->other = -1;
|
||||
+ }
|
||||
+
|
||||
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
|
||||
+ if (!mem) {
|
||||
+ snmp_log_perror("No Virtual Memory info entry");
|
||||
+ } else {
|
||||
+ if (!mem->descr)
|
||||
+ mem->descr = strdup("Virtual memory");
|
||||
+ mem->units = pagesize;
|
||||
+ mem->size = total.t_vm;
|
||||
+ mem->free = total.t_avm;
|
||||
+ }
|
||||
+
|
||||
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 1 );
|
||||
+ if (!mem) {
|
||||
+ snmp_log_perror("No Shared Memory info entry");
|
||||
+ } else {
|
||||
+ if (!mem->descr)
|
||||
+ mem->descr = strdup("Shared virtual memory");
|
||||
+ mem->units = pagesize;
|
||||
+ mem->size = total.t_vmshr;
|
||||
+ mem->free = total.t_avmshr;
|
||||
+ }
|
||||
+
|
||||
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED2, 1 );
|
||||
+ if (!mem) {
|
||||
+ snmp_log_perror("No Shared2 Memory info entry");
|
||||
+ } else {
|
||||
+ if (!mem->descr)
|
||||
+ mem->descr = strdup("Shared real memory");
|
||||
+ mem->units = pagesize;
|
||||
+ mem->size = total.t_rmshr;
|
||||
+ mem->free = total.t_armshr;
|
||||
}
|
||||
|
||||
#ifdef SWAP_NSWAP
|
||||
@@ -91,7 +144,17 @@
|
||||
mem->units = pagesize;
|
||||
mem->size = uvmexp.swpages;
|
||||
mem->free = uvmexp.swpages - uvmexp.swpginuse;
|
||||
- mem->other = -1;
|
||||
+ }
|
||||
+
|
||||
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 );
|
||||
+ if (!mem) {
|
||||
+ snmp_log_perror("No Buffer, etc info entry");
|
||||
+ } else {
|
||||
+ if (!mem->descr)
|
||||
+ mem->descr = strdup("Memory buffers");
|
||||
+ mem->units = 1024;
|
||||
+ mem->size = maxbufspace / 1024;
|
||||
+ mem->free = (maxbufspace - bufspace)/1024;
|
||||
}
|
||||
|
||||
return 0;
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-ai,v 1.6 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-ai,v 1.7 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/ip.c.orig 2008-06-06 15:51:31.000000000 +0100
|
||||
+++ agent/mibgroup/mibII/ip.c 2008-06-06 15:55:38.000000000 +0100
|
||||
@@ -241,6 +241,18 @@
|
||||
--- agent/mibgroup/mibII/ip.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/ip.c
|
||||
@@ -255,6 +255,18 @@ long ipTTL, oldipTTL;
|
||||
#define USES_TRADITIONAL_IPSTAT
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-aj,v 1.6 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-aj,v 1.7 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/udp.c.orig 2007-07-16 19:59:44.000000000 -0400
|
||||
+++ agent/mibgroup/mibII/udp.c 2008-06-04 19:46:27.000000000 -0400
|
||||
@@ -162,6 +162,12 @@
|
||||
--- agent/mibgroup/mibII/udp.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/udp.c
|
||||
@@ -151,6 +151,12 @@ init_udp(void)
|
||||
#define USES_TRADITIONAL_UDPSTAT
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-ak,v 1.5 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-ak,v 1.6 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/icmp.c.orig 2007-07-16 19:59:44.000000000 -0400
|
||||
+++ agent/mibgroup/mibII/icmp.c 2008-06-04 19:42:01.000000000 -0400
|
||||
@@ -455,6 +455,13 @@
|
||||
--- agent/mibgroup/mibII/icmp.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/icmp.c
|
||||
@@ -621,6 +621,13 @@ bail:
|
||||
#define USES_TRADITIONAL_ICMPSTAT
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
$NetBSD: patch-al,v 1.5 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/host/hr_network.c.orig 2005-10-28 20:49:36.000000000 +0200
|
||||
+++ agent/mibgroup/host/hr_network.c
|
||||
@@ -194,6 +194,10 @@ static netsnmp_interface_entry *HRN_ifne
|
||||
static char HRN_name[MAX_PHYSADDR_LEN];
|
||||
static nmapi_phystat HRN_ifnet;
|
||||
#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c)
|
||||
+#elif defined darwin
|
||||
+static char HRN_name[IFNAMSIZ];
|
||||
+static struct if_msghdr HRN_ifnet;
|
||||
+#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c, d)
|
||||
#else /* hpux11 */
|
||||
static char HRN_name[16];
|
||||
#ifndef WIN32
|
||||
@@ -223,7 +227,7 @@ int
|
||||
Get_Next_HR_Network(void)
|
||||
{
|
||||
short HRN_index;
|
||||
-#if !defined( solaris2) && ! defined( WIN32 )
|
||||
+#if !defined(solaris2) && !defined(darwin) && !defined(WIN32)
|
||||
if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL) == 0)
|
||||
HRN_index = -1;
|
||||
#else
|
||||
@@ -246,7 +250,11 @@ Save_HR_Network_Info(void)
|
||||
HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
|
||||
HRN_savedErrors = HRN_ifnet.if_entry.ifInErrors +
|
||||
HRN_ifnet.if_entry.ifOutErrors;
|
||||
-#else /* hpux11 */
|
||||
+#elif defined(__APPLE__)
|
||||
+ HRN_savedFlags = HRN_ifnet.ifm_flags;
|
||||
+ HRN_savedFlags = HRN_ifnet.ifm_data.ifi_ierrors +
|
||||
+ HRN_ifnet.ifm_data.ifi_oerrors;
|
||||
+#else
|
||||
#ifndef WIN32
|
||||
HRN_savedFlags = HRN_ifnet.if_flags;
|
||||
HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
|
|
@ -1,83 +1,16 @@
|
|||
$NetBSD: patch-am,v 1.11 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-am,v 1.12 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/host/hr_swrun.c.orig 2010-07-29 14:58:47.000000000 +0000
|
||||
--- agent/mibgroup/host/hr_swrun.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/host/hr_swrun.c
|
||||
@@ -614,6 +614,8 @@ var_hrswrun(struct variable * vp,
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
#if defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
strcpy(string, proc_table[LowProcIndex].ki_comm);
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ strcpy(string, proc_table[LowProcIndex].kp_comm);
|
||||
#else
|
||||
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
|
||||
#endif
|
||||
@@ -737,6 +739,8 @@ var_hrswrun(struct variable * vp,
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
#if defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
strcpy(string, proc_table[LowProcIndex].ki_comm);
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ strcpy(string, proc_table[LowProcIndex].kp_comm);
|
||||
#else
|
||||
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
|
||||
#endif
|
||||
@@ -943,11 +947,17 @@ var_hrswrun(struct variable * vp,
|
||||
} else
|
||||
long_return = 4; /* application */
|
||||
#else
|
||||
+ #if defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ if (proc_table[LowProcIndex].kp_flags & P_SYSTEM)
|
||||
+ #else
|
||||
if (proc_table[LowProcIndex].kp_proc.p_flag & P_SYSTEM)
|
||||
+ #endif
|
||||
long_return = 2; /* operatingSystem */
|
||||
@@ -1012,8 +1012,10 @@ var_hrswrun(struct variable * vp,
|
||||
else
|
||||
long_return = 4; /* application */
|
||||
#endif
|
||||
-#else
|
||||
+#elif defined darwin
|
||||
+ long_return = -1;
|
||||
#else
|
||||
long_return = 4; /* application */
|
||||
+#else
|
||||
#endif
|
||||
@@ -984,6 +994,8 @@ var_hrswrun(struct variable * vp,
|
||||
#if HAVE_KVM_GETPROCS
|
||||
#if defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
switch (proc_table[LowProcIndex].ki_stat) {
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ switch (proc_table[LowProcIndex].kp_stat) {
|
||||
#else
|
||||
switch (proc_table[LowProcIndex].kp_proc.p_stat) {
|
||||
#endif
|
||||
@@ -1091,6 +1103,14 @@ var_hrswrun(struct variable * vp,
|
||||
long_return = 0;
|
||||
#elif defined(freebsd5)
|
||||
long_return = proc_table[LowProcIndex].ki_runtime / 100000;
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ long_return = proc_table[LowProcIndex].kp_lwp.kl_uticks +
|
||||
+ proc_table[LowProcIndex].kp_lwp.kl_sticks +
|
||||
+ proc_table[LowProcIndex].kp_lwp.kl_iticks;
|
||||
+ #elif defined(dragonfly)
|
||||
+ long_return = proc_table[LowProcIndex].kp_eproc.e_uticks +
|
||||
+ proc_table[LowProcIndex].kp_eproc.e_sticks +
|
||||
+ proc_table[LowProcIndex].kp_eproc.e_iticks;
|
||||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
|
||||
proc_table[LowProcIndex].kp_proc.p_sticks +
|
||||
@@ -1208,6 +1228,8 @@ var_hrswrun(struct variable * vp,
|
||||
long_return =
|
||||
#if defined(freebsd5)
|
||||
proc_table[LowProcIndex].ki_size / 1024;
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ proc_table[LowProcIndex].kp_vm_map_size / 1024;
|
||||
#else
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
|
||||
#endif
|
||||
@@ -1528,6 +1550,9 @@ Get_Next_HR_SWRun(void)
|
||||
#if defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
if (proc_table[current_proc_entry].ki_stat != 0)
|
||||
return proc_table[current_proc_entry++].ki_pid;
|
||||
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
|
||||
+ if (proc_table[current_proc_entry].kp_stat != 0)
|
||||
+ return proc_table[current_proc_entry++].kp_pid;
|
||||
#else
|
||||
if (proc_table[current_proc_entry].kp_proc.p_stat != 0)
|
||||
return proc_table[current_proc_entry++].kp_proc.p_pid;
|
||||
return (u_char *) & long_return;
|
||||
case HRSWRUN_STATUS:
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
$NetBSD: patch-an,v 1.4 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/route_write.c.orig 2010-03-20 19:36:28.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/route_write.c
|
||||
@@ -93,7 +93,7 @@
|
||||
int
|
||||
addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
|
||||
{
|
||||
-#if defined SIOCADDRT && !defined(irix6)
|
||||
+#if defined SIOCADDRT && !defined(irix6) && !defined(darwin)
|
||||
struct sockaddr_in dst;
|
||||
struct sockaddr_in gateway;
|
||||
int s, rc;
|
||||
@@ -128,6 +128,54 @@ addRoute(u_long dstip, u_long gwip, u_lo
|
||||
if (rc < 0)
|
||||
snmp_log_perror("ioctl");
|
||||
return rc;
|
||||
+#elif defined darwin
|
||||
+ size_t sa_in_size = sizeof(struct sockaddr_in);
|
||||
+ int s, rc;
|
||||
+ struct sockaddr_in dst;
|
||||
+ struct sockaddr_in gateway;
|
||||
+ struct {
|
||||
+ struct rt_msghdr hdr;
|
||||
+ char space[512];
|
||||
+ } rtmsg;
|
||||
+
|
||||
+ s = socket(PF_ROUTE, SOCK_RAW, 0);
|
||||
+ if (s < 0) {
|
||||
+ snmp_log_perror("socket");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ shutdown(s, SHUT_RD);
|
||||
+ /* possible panic otherwise */
|
||||
+ flags |= (RTF_UP | RTF_GATEWAY);
|
||||
+
|
||||
+ bzero((char *)&dst, sa_in_size);
|
||||
+ dst.sin_len = sa_in_size;
|
||||
+ dst.sin_family = AF_INET;
|
||||
+ dst.sin_addr.s_addr = htonl(dstip);
|
||||
+
|
||||
+ bzero((char *)&gateway, sa_in_size);
|
||||
+ gateway.sin_len = sa_in_size;
|
||||
+ gateway.sin_family = AF_INET;
|
||||
+ gateway.sin_addr.s_addr = htonl(gwip);
|
||||
+
|
||||
+ bzero((char *)&rtmsg, sizeof(rtmsg));
|
||||
+ rtmsg.hdr.rtm_type = RTM_ADD;
|
||||
+ rtmsg.hdr.rtm_version = RTM_VERSION;
|
||||
+ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
|
||||
+ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
|
||||
+
|
||||
+ bcopy((char *)&dst, rtmsg.space, sa_in_size);
|
||||
+ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
|
||||
+
|
||||
+ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
|
||||
+ rtmsg.hdr.rtm_msglen = rc;
|
||||
+
|
||||
+ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
|
||||
+ snmp_log_perror("writing to routing socket");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return (rc);
|
||||
|
||||
#else /* SIOCADDRT */
|
||||
return -1;
|
||||
@@ -139,7 +187,7 @@ addRoute(u_long dstip, u_long gwip, u_lo
|
||||
int
|
||||
delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
|
||||
{
|
||||
-#if defined SIOCDELRT && !defined(irix6)
|
||||
+#if defined SIOCDELRT && !defined(irix6) && !defined(darwin)
|
||||
|
||||
struct sockaddr_in dst;
|
||||
struct sockaddr_in gateway;
|
||||
@@ -174,6 +222,56 @@ delRoute(u_long dstip, u_long gwip, u_lo
|
||||
close(s);
|
||||
return rc;
|
||||
|
||||
+#elif defined darwin
|
||||
+ size_t sa_in_size = sizeof(struct sockaddr_in);
|
||||
+ int s, rc;
|
||||
+ struct sockaddr_in dst;
|
||||
+ struct sockaddr_in gateway;
|
||||
+ struct {
|
||||
+ struct rt_msghdr hdr;
|
||||
+ char space[512];
|
||||
+ } rtmsg;
|
||||
+
|
||||
+ s = socket(PF_ROUTE, SOCK_RAW, 0);
|
||||
+
|
||||
+ if (s < 0) {
|
||||
+ snmp_log_perror("socket");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ shutdown(s, SHUT_RD);
|
||||
+ /* possible panic otherwise */
|
||||
+ flags |= (RTF_UP | RTF_GATEWAY);
|
||||
+
|
||||
+ bzero((char *)&dst, sa_in_size);
|
||||
+ dst.sin_len = sa_in_size;
|
||||
+ dst.sin_family = AF_INET;
|
||||
+ dst.sin_addr.s_addr = htonl(dstip);
|
||||
+
|
||||
+ bzero((char *)&gateway, sa_in_size);
|
||||
+ gateway.sin_len = sa_in_size;
|
||||
+ gateway.sin_family = AF_INET;
|
||||
+ gateway.sin_addr.s_addr = htonl(gwip);
|
||||
+
|
||||
+ bzero((char *)&rtmsg, sizeof(rtmsg));
|
||||
+ rtmsg.hdr.rtm_type = RTM_DELETE;
|
||||
+ rtmsg.hdr.rtm_version = RTM_VERSION;
|
||||
+ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
|
||||
+ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
|
||||
+
|
||||
+ bcopy((char *)&dst, rtmsg.space, sa_in_size);
|
||||
+ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
|
||||
+
|
||||
+ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
|
||||
+ rtmsg.hdr.rtm_msglen = rc;
|
||||
+
|
||||
+ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
|
||||
+ snmp_log_perror("writing to routing socket");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+
|
||||
#else /* SIOCDELRT */
|
||||
return 0;
|
||||
#endif
|
|
@ -1,13 +1,13 @@
|
|||
$NetBSD: patch-ap,v 1.2 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-ap,v 1.3 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
Some systems define ifnet.if_lastchange as struct timespec (with a
|
||||
tv_nsec field measured in nanoseconds), while other systems define it
|
||||
as struct timeval (with a tv_usec field measured in microseconds).
|
||||
Both variants have a tv_sec field for integer seconds.
|
||||
|
||||
--- agent/mibgroup/mibII/interfaces.c.orig 2008-06-05 23:11:53.000000000 +0200
|
||||
--- agent/mibgroup/mibII/interfaces.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/interfaces.c
|
||||
@@ -847,15 +847,25 @@ var_ifEntry(struct variable *vp,
|
||||
@@ -871,15 +871,25 @@ var_ifEntry(struct variable *vp,
|
||||
* * this is fixed, thus the 199607 comparison.
|
||||
*/
|
||||
if (ifnet.if_lastchange.tv_sec == 0 &&
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
$NetBSD: patch-aq,v 1.2 2011/05/31 10:52:31 adam Exp $
|
||||
$NetBSD: patch-aq,v 1.3 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/auto_nlist.c.orig 2011-04-27 11:31:53.000000000 +0000
|
||||
--- agent/auto_nlist.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/auto_nlist.c
|
||||
@@ -73,7 +73,6 @@ auto_nlist_value(const char *string)
|
||||
#if !(defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7))
|
||||
if (it->nl[0].n_type == 0) {
|
||||
strcpy(it->nl[0].n_name, string);
|
||||
- it->nl[0].n_name[strlen(string)+1] = '\0';
|
||||
init_nlist(it->nl);
|
||||
}
|
||||
#endif
|
||||
@@ -67,7 +67,7 @@ auto_nlist_value(const char *string)
|
||||
it->nl[0].n_name = (char *) malloc(strlen(string) + 2);
|
||||
#if defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7)
|
||||
strcpy(it->nl[0].n_name, string);
|
||||
- it->nl[0].n_name[strlen(string)+1] = '\0';
|
||||
+ /* it->nl[0].n_name[strlen(string)+1] = '\0'; */
|
||||
#elif defined(freebsd9)
|
||||
sprintf(__DECONST(char*, it->nl[0].n_name), "_%s", string);
|
||||
#else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-da,v 1.1 2006/03/19 22:03:29 joerg Exp $
|
||||
$NetBSD: patch-da,v 1.2 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- ov/UCD-fields.orig 2006-03-19 18:20:29.000000000 +0000
|
||||
--- ov/UCD-fields.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ ov/UCD-fields
|
||||
@@ -11,6 +11,7 @@ Field "SNMPAgent" {
|
||||
"UCD Ultrix",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-db,v 1.1 2006/03/19 22:03:29 joerg Exp $
|
||||
$NetBSD: patch-db,v 1.2 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- ov/oid_to_type.in.orig 2006-03-19 18:20:47.000000000 +0000
|
||||
--- ov/oid_to_type.in.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ ov/oid_to_type.in
|
||||
@@ -6,6 +6,7 @@ EXTENSIBLEDOTMIB.AGENTID.OSFID:DEC:UCD O
|
||||
EXTENSIBLEDOTMIB.AGENTID.ULTRIXID:DEC:UCD Ultrix
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
$NetBSD: patch-dc,v 1.8 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- include/net-snmp/net-snmp-config.h.in.orig 2010-11-30 05:56:25.000000000 +0000
|
||||
+++ include/net-snmp/net-snmp-config.h.in
|
||||
@@ -767,6 +767,9 @@
|
||||
/* Define to 1 if `if_lastchange.tv_sec' is member of `struct ifnet'. */
|
||||
#undef HAVE_STRUCT_IFNET_IF_LASTCHANGE_TV_SEC
|
||||
|
||||
+/* Define to 1 if `if_lastchange.tv_nsec' is member of `struct ifnet'. */
|
||||
+#undef HAVE_STRUCT_IFNET_IF_LASTCHANGE_TV_NSEC
|
||||
+
|
||||
/* Define to 1 if `if_mtu' is member of `struct ifnet'. */
|
||||
#undef HAVE_STRUCT_IFNET_IF_MTU
|
||||
|
||||
@@ -1715,6 +1718,7 @@
|
||||
#define NETSNMP_HPUX11ID 14
|
||||
#define NETSNMP_AIXID 15
|
||||
#define NETSNMP_MACOSXID 16
|
||||
+#define NETSNMP_DRAGONFLYID 17
|
||||
#define NETSNMP_UNKNOWNID 255
|
||||
|
||||
#ifdef hpux9
|
||||
@@ -1744,6 +1748,9 @@
|
||||
#if defined(__FreeBSD__)
|
||||
#define NETSNMP_OSTYPE NETSNMP_FREEBSDID
|
||||
#endif
|
||||
+#if defined(__DragonFly__)
|
||||
+#define OSTYPE DRAGONFLYID
|
||||
+#endif
|
||||
#if defined(irix6) || defined(irix5)
|
||||
#define NETSNMP_OSTYPE NETSNMP_IRIXID
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
$NetBSD: patch-dd,v 1.2 2007/02/05 12:06:16 adam Exp $
|
||||
|
||||
--- sedscript.in.orig 2006-11-24 18:53:18.000000000 +0100
|
||||
+++ sedscript.in
|
||||
@@ -96,6 +96,7 @@ s/FREMOVEMEREEBSDID/FREEBSDID/g
|
||||
s/IREMOVEMERIXID/IRIXID/g
|
||||
s/LREMOVEMEINUXID/LINUXID/g
|
||||
s/BREMOVEMESDIID/BSDIID/g
|
||||
+s/DREMOVEMERAGONFLYID/DRAGONFLYID/g
|
||||
s/UREMOVEMENKNOWNID/UNKNOWNID/g
|
||||
|
||||
s#PREMOVEMESCMD#PSCMD#g
|
|
@ -1,369 +0,0 @@
|
|||
$NetBSD: patch-de,v 1.8 2012/05/17 14:37:07 marino Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/ipv6.c.orig 2010-12-08 13:17:10.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/ipv6.c
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
# if HAVE_SYS_SOCKETVAR_H
|
||||
# include <sys/socketvar.h>
|
||||
# endif
|
||||
@@ -51,7 +51,13 @@
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
#if HAVE_NET_IF_VAR_H
|
||||
+# ifdef __DragonFly__
|
||||
+# define _KERNEL_STRUCTURES
|
||||
+# endif
|
||||
#include <net/if_var.h>
|
||||
+# ifdef __DragonFly__
|
||||
+# undef _KERNEL_STRUCTURES
|
||||
+# endif
|
||||
#endif
|
||||
#if HAVE_NET_IF_DL_H
|
||||
#include <net/if_dl.h>
|
||||
@@ -80,7 +86,7 @@
|
||||
# include <netinet6/ip6_var.h>
|
||||
#endif
|
||||
#include <net/route.h>
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
# if HAVE_NETINET_IN_PCB_H
|
||||
# include <netinet/in_pcb.h>
|
||||
# endif
|
||||
@@ -616,7 +622,7 @@ if_getifnet(int idx, struct ifnet *resul
|
||||
memcpy(result, &tmp, sizeof(tmp));
|
||||
return 0;
|
||||
}
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
q = (caddr_t) TAILQ_NEXT(&tmp, if_link);
|
||||
#else
|
||||
# if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
@@ -846,13 +852,36 @@ var_ifv6Entry(register struct variable *
|
||||
{
|
||||
struct ifnet ifnet;
|
||||
struct ifaddr ifaddr;
|
||||
+#if defined(__DragonFly__) && __DragonFly_version >= 197700
|
||||
+ struct ifaddr_container ifac;
|
||||
+ struct ifaddrhead head;
|
||||
+#endif
|
||||
static struct sockaddr_dl sdl;
|
||||
caddr_t ifa;
|
||||
|
||||
if (if_getifnet(interface, &ifnet) < 0)
|
||||
break;
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
+# if defined(__DragonFly__) && __DragonFly_version >= 197700
|
||||
+ /*
|
||||
+ * Locate ifaddr head on CPU0
|
||||
+ */
|
||||
+ if (!NETSNMP_KLOOKUP(ifnet.if_addrheads, (char *)&head, sizeof(head))) {
|
||||
+ DEBUGMSGTL(("mibII/ipv6:var_ipv6", "klookup head failed\n"));
|
||||
+ break;
|
||||
+ }
|
||||
+ if (TAILQ_FIRST(&head) != NULL) {
|
||||
+ if (!NETSNMP_KLOOKUP(TAILQ_FIRST(&head), (char *) &ifac, sizeof(ifac))) {
|
||||
+ DEBUGMSGTL(("mibII/ipv6:var_ipv6", "klookup ifac failed\n"));
|
||||
+ break;
|
||||
+ }
|
||||
+ ifa = (caddr_t)ifac.ifa;
|
||||
+ } else {
|
||||
+ ifa = NULL;
|
||||
+ }
|
||||
+# else
|
||||
ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrhead);
|
||||
+# endif
|
||||
#else
|
||||
# if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrlist);
|
||||
@@ -878,8 +907,20 @@ var_ifv6Entry(register struct variable *
|
||||
*var_len = sdl.sdl_alen;
|
||||
return (u_char *) (sdl.sdl_data + sdl.sdl_nlen);
|
||||
}
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
+# if defined(__DragonFly__) && __DragonFly_version >= 197700
|
||||
+ if (TAILQ_NEXT(&ifac, ifa_link) == NULL) {
|
||||
+ ifa = NULL;
|
||||
+ } else {
|
||||
+ if (!NETSNMP_KLOOKUP(TAILQ_NEXT(&ifac, ifa_link), (char *)&ifac, sizeof(ifac))) {
|
||||
+ DEBUGMSGTL(("mibII/ipv6:var_ipv6", "klookup ifac next failed\n"));
|
||||
+ break;
|
||||
+ }
|
||||
+ ifa = (caddr_t)ifac.ifa;
|
||||
+ }
|
||||
+# else
|
||||
ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_link);
|
||||
+# endif
|
||||
#else
|
||||
# if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_list);
|
||||
@@ -1285,7 +1326,11 @@ var_udp6(register struct variable * vp,
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
struct inpcbtable udbtable;
|
||||
caddr_t first;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(dragonfly)
|
||||
+ char *sysctl_buf;
|
||||
+ struct xinpcb *xig;
|
||||
+ size_t sysctl_len;
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
char *sysctl_buf;
|
||||
struct xinpgen *xig, *oxig;
|
||||
#else
|
||||
@@ -1300,10 +1345,31 @@ var_udp6(register struct variable * vp,
|
||||
if (!auto_nlist("udbtable", (char *) &udbtable, sizeof(udbtable)))
|
||||
return NULL;
|
||||
first = p = (caddr_t)udbtable.inpt_queue.cqh_first;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6)))
|
||||
return NULL;
|
||||
p = (caddr_t) udb6.in6p_next;
|
||||
+#elif defined(dragonfly)
|
||||
+ {
|
||||
+ const char *udblist = "net.inet.udp.pcblist";
|
||||
+ const char *pp = udblist;
|
||||
+
|
||||
+ if (sysctlbyname(udblist, 0, &sysctl_len, 0, 0) < 0)
|
||||
+ return NULL;
|
||||
+ if ((sysctl_buf = malloc(sysctl_len)) == NULL)
|
||||
+ return NULL;
|
||||
+ udblist = pp;
|
||||
+ if (sysctlbyname(udblist, sysctl_buf, &sysctl_len, 0, 0) < 0) {
|
||||
+ free(sysctl_buf);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ xig = (struct xinpcb *) sysctl_buf;
|
||||
+ if (xig->xi_len != sizeof(*xig)) {
|
||||
+ free(sysctl_buf);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ p = (caddr_t) ((char *) xig); /* silence compiler warning */
|
||||
+ }
|
||||
#else
|
||||
{
|
||||
const char *udblist = "net.inet.udp.pcblist";
|
||||
@@ -1331,15 +1397,17 @@ var_udp6(register struct variable * vp,
|
||||
while (
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p && p != first
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p && (u_long) p != auto_nlist_value("udb6")
|
||||
+#elif defined(dragonfly)
|
||||
+ (char *)xig + xig->xi_len <= sysctl_buf + sysctl_len
|
||||
#else
|
||||
xig->xig_len > sizeof(struct xinpgen)
|
||||
#endif
|
||||
) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
|
||||
|
||||
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#if !defined(freebsd3) && !defined(darwin)
|
||||
if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "klookup fail for udb6 at %x\n",
|
||||
p));
|
||||
@@ -1352,7 +1420,7 @@ var_udp6(register struct variable * vp,
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
if (in6pcb.in6p_af != AF_INET6)
|
||||
goto skip;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
if (0 == (in6pcb.inp_vflag & INP_IPV6))
|
||||
goto skip;
|
||||
#endif
|
||||
@@ -1395,13 +1463,15 @@ var_udp6(register struct variable * vp,
|
||||
skip:
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p = (caddr_t)in6pcb.in6p_queue.cqe_next;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p = (caddr_t) in6pcb.in6p_next;
|
||||
+#elif defined(__DragonFly__)
|
||||
+ xig = (struct xinpcb *) ((char *) xig + xig->xi_len);
|
||||
#else
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
#endif
|
||||
}
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
free(sysctl_buf);
|
||||
#endif
|
||||
DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
|
||||
@@ -1460,7 +1530,7 @@ var_tcp6(register struct variable * vp,
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
struct inpcbtable tcbtable;
|
||||
caddr_t first;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
char *sysctl_buf;
|
||||
struct xinpgen *xig, *oxig;
|
||||
#else
|
||||
@@ -1490,7 +1560,7 @@ var_tcp6(register struct variable * vp,
|
||||
if (!auto_nlist("tcbtable", (char *) &tcbtable, sizeof(tcbtable)))
|
||||
return NULL;
|
||||
first = p = (caddr_t)tcbtable.inpt_queue.cqh_first;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
|
||||
return NULL;
|
||||
p = (caddr_t) tcb6.in6p_next;
|
||||
@@ -1521,7 +1591,7 @@ var_tcp6(register struct variable * vp,
|
||||
while (
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p && p != first
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p && (u_long) p != auto_nlist_value("tcb6")
|
||||
#else
|
||||
xig->xig_len > sizeof(struct xinpgen)
|
||||
@@ -1529,7 +1599,7 @@ var_tcp6(register struct variable * vp,
|
||||
) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
|
||||
|
||||
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#if !defined(freebsd3) && !defined(darwin)
|
||||
if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n",
|
||||
p));
|
||||
@@ -1542,7 +1612,7 @@ var_tcp6(register struct variable * vp,
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
if (in6pcb.in6p_af != AF_INET6)
|
||||
goto skip;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
if (0 == (in6pcb.inp_vflag & INP_IPV6))
|
||||
goto skip;
|
||||
#endif
|
||||
@@ -1599,13 +1669,13 @@ var_tcp6(register struct variable * vp,
|
||||
skip:
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p = (caddr_t)in6pcb.in6p_queue.cqe_next;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p = (caddr_t) in6pcb.in6p_next;
|
||||
#else
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
#endif
|
||||
}
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
free(sysctl_buf);
|
||||
#endif
|
||||
DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
|
||||
@@ -1697,7 +1767,11 @@ var_tcp6(register struct variable * vp,
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
struct inpcbtable tcbtable;
|
||||
caddr_t first;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(dragonfly)
|
||||
+ char *sysctl_buf;
|
||||
+ size_t sysctl_len;
|
||||
+ struct xtcpcb *xtp;
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
char *sysctl_buf;
|
||||
struct xinpgen *xig, *oxig;
|
||||
#else
|
||||
@@ -1712,10 +1786,31 @@ var_tcp6(register struct variable * vp,
|
||||
if (!auto_nlist("tcbtable", (char *) &tcbtable, sizeof(tcbtable)))
|
||||
return NULL;
|
||||
first = p = (caddr_t)tcbtable.inpt_queue.cqh_first;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
|
||||
return NULL;
|
||||
p = (caddr_t) tcb6.in6p_next;
|
||||
+#elif defined(dragonfly)
|
||||
+ {
|
||||
+ const char *tcblist = "net.inet.tcp.pcblist";
|
||||
+ const char *pp = tcblist;
|
||||
+
|
||||
+ if (sysctlbyname(tcblist, 0, &sysctl_len, 0, 0) < 0)
|
||||
+ return NULL;
|
||||
+ if ((sysctl_buf = malloc(sysctl_len)) == NULL)
|
||||
+ return NULL;
|
||||
+ tcblist = pp;
|
||||
+ if (sysctlbyname(tcblist, sysctl_buf, &sysctl_len, 0, 0) < 0) {
|
||||
+ free(sysctl_buf);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ xtp = (struct xtcpcb *) sysctl_buf;
|
||||
+ if (xtp->xt_len != sizeof(*xtp)) {
|
||||
+ free(sysctl_buf);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ p = (caddr_t) ((char *) xtp); /* silence compiler warning */
|
||||
+ }
|
||||
#else
|
||||
{
|
||||
const char *tcblist = "net.inet.tcp.pcblist";
|
||||
@@ -1732,7 +1827,8 @@ var_tcp6(register struct variable * vp,
|
||||
return NULL;
|
||||
}
|
||||
oxig = (struct xinpgen *) sysctl_buf;
|
||||
- xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
|
||||
+ xig = (struct xinpgen *) ((char *) oxtp + oxtp->xt_len);
|
||||
+ if (oxig
|
||||
p = (caddr_t) ((char *) xig); /* silence compiler warning */
|
||||
}
|
||||
#endif
|
||||
@@ -1743,28 +1839,32 @@ var_tcp6(register struct variable * vp,
|
||||
while (
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p && p != first
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p && (u_long) p != auto_nlist_value("tcb6")
|
||||
+#elif defined(dragonfly)
|
||||
+ (char *)xtp + xtp->xt_len < sysctl_buf + sysctl_len
|
||||
#else
|
||||
xig->xig_len > sizeof(struct xinpgen)
|
||||
#endif
|
||||
) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
|
||||
|
||||
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#if !defined(freebsd3) && !defined(darwin)
|
||||
if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
|
||||
DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n",
|
||||
p));
|
||||
found = 0;
|
||||
break;
|
||||
}
|
||||
+#elif defined(dragonfly)
|
||||
+ in6pcb = xtp->xt_inp;
|
||||
#else
|
||||
in6pcb = ((struct xinpcb *) xig)->xi_inp;
|
||||
#endif
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
if (in6pcb.in6p_af != AF_INET6)
|
||||
goto skip;
|
||||
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#elif defined(freebsd3) || defined(darwin)
|
||||
if (0 == (in6pcb.inp_vflag & INP_IPV6))
|
||||
goto skip;
|
||||
#endif
|
||||
@@ -1820,13 +1920,15 @@ var_tcp6(register struct variable * vp,
|
||||
skip:
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
|
||||
p = (caddr_t)in6pcb.in6p_queue.cqe_next;
|
||||
-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
|
||||
+#elif !defined(freebsd3) && !defined(darwin)
|
||||
p = (caddr_t) in6pcb.in6p_next;
|
||||
+#elif defined(dragonfly)
|
||||
+ xtp = (struct xtcpcb *) ((char *)xtp + xtp->xt_len);
|
||||
#else
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
#endif
|
||||
}
|
||||
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
|
||||
+#if defined(freebsd3) || defined(darwin)
|
||||
free(sysctl_buf);
|
||||
#endif
|
||||
DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
|
|
@ -1,20 +0,0 @@
|
|||
$NetBSD: patch-df,v 1.4 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/hardware/cpu.h.orig 2010-07-29 14:58:47.000000000 +0000
|
||||
+++ agent/mibgroup/hardware/cpu.h
|
||||
@@ -12,12 +12,12 @@ config_require(hardware/cpu/cpu_pcp)
|
||||
#elif defined(irix6)
|
||||
config_require(hardware/cpu/cpu_sysinfo)
|
||||
|
||||
+#elif (defined(freebsd2) || defined(freebsd3) || defined(dragonfly))
|
||||
+config_require(hardware/cpu/cpu_nlist)
|
||||
+
|
||||
#elif (defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2)|| defined(netbsdelf3) || defined(openbsd2) || defined(openbsd3) || defined(openbsd4) || defined(freebsd4) || defined(freebsd5) || defined(freebsd6))
|
||||
config_require(hardware/cpu/cpu_sysctl)
|
||||
|
||||
-#elif (defined(freebsd2) || defined(freebsd3))
|
||||
-config_require(hardware/cpu/cpu_nlist)
|
||||
-
|
||||
#elif (defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7))
|
||||
config_require(hardware/cpu/cpu_perfstat)
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
$NetBSD: patch-dg,v 1.1 2006/03/19 22:03:29 joerg Exp $
|
||||
|
||||
--- mibs/NET-SNMP-TC.txt.orig 2006-03-19 19:01:33.000000000 +0000
|
||||
+++ mibs/NET-SNMP-TC.txt
|
||||
@@ -93,6 +93,7 @@ win32 OBJECT IDENTIFIER ::= { netSnmp
|
||||
hpux11 OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 14 }
|
||||
aix OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 15 }
|
||||
macosx OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 16 }
|
||||
+dragonfly OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 17 }
|
||||
unknown OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 255 }
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
$NetBSD: patch-dh,v 1.4 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- mibs/UCD-SNMP-MIB.txt.orig 2010-04-06 08:56:20.000000000 +0000
|
||||
+++ mibs/UCD-SNMP-MIB.txt
|
||||
@@ -140,6 +140,9 @@ bsdi OBJECT IDENTIFIER ::=
|
||||
openbsd OBJECT IDENTIFIER ::= { ucdSnmpAgent 12 }
|
||||
win32 OBJECT IDENTIFIER ::= { ucdSnmpAgent 13 } -- unlucky
|
||||
hpux11 OBJECT IDENTIFIER ::= { ucdSnmpAgent 14 }
|
||||
+aix OBJECT IDENTIFIER ::= { ucdSnmpAgent 15 }
|
||||
+macosx OBJECT IDENTIFIER ::= { ucdSnmpAgent 16 }
|
||||
+dragonfly OBJECT IDENTIFIER ::= { ucdSnmpAgent 17 }
|
||||
unknown OBJECT IDENTIFIER ::= { ucdSnmpAgent 255 }
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
$NetBSD: patch-di,v 1.1 2006/03/19 22:03:29 joerg Exp $
|
||||
|
||||
--- ov/oid_to_sym.in.orig 2006-03-19 19:03:39.000000000 +0000
|
||||
+++ ov/oid_to_sym.in
|
||||
@@ -14,4 +14,5 @@ EXTENSIBLEDOTMIB.AGENTID.WIN32ID:Compute
|
||||
EXTENSIBLEDOTMIB.AGENTID.HPUX11ID:Computer:UCD # UCD HP-UX 11
|
||||
EXTENSIBLEDOTMIB.AGENTID.AIXID:Computer:UCD # UCD AIX
|
||||
EXTENSIBLEDOTMIB.AGENTID.MACOSXID:Computer:UCD # UCD Mac OS X
|
||||
+EXTENSIBLEDOTMIB.AGENTID.DRAGONFLYID:Computer:UCD # UCD DragonFly
|
||||
EXTENSIBLEDOTMIB.AGENTID.UNKNOWNID:Computer:UCD # UCD Unknown
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-dl,v 1.5 2011/05/27 10:55:25 adam Exp $
|
||||
$NetBSD: patch-dl,v 1.6 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/tcp.c.orig 2010-11-30 04:04:26.000000000 +0000
|
||||
--- agent/mibgroup/mibII/tcp.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/tcp.c
|
||||
@@ -180,6 +180,16 @@ init_tcp(void)
|
||||
@@ -197,6 +197,16 @@ init_tcp(void)
|
||||
#define USES_TRADITIONAL_TCPSTAT
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@ $NetBSD: patch-dl,v 1.5 2011/05/27 10:55:25 adam Exp $
|
|||
#if !defined(TCP_STAT_STRUCTURE)
|
||||
#define TCP_STAT_STRUCTURE struct tcpstat
|
||||
#define USES_TRADITIONAL_TCPSTAT
|
||||
@@ -307,6 +317,75 @@ tcp_handler(netsnmp_mib_handler
|
||||
@@ -324,6 +334,75 @@ tcp_handler(netsnmp_mib_handler
|
||||
#endif /* linux */
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
continue;
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
$NetBSD: patch-dm,v 1.2 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/vmstat_freebsd2.c.orig 2008-10-21 21:10:43.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/vmstat_freebsd2.c
|
||||
@@ -9,9 +9,15 @@
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
+#if defined(dragonfly)
|
||||
+#include <sys/user.h>
|
||||
+#else
|
||||
#include <sys/proc.h>
|
||||
+#endif
|
||||
#if defined(freebsd5) && __FreeBSD_version >= 500101
|
||||
#include <sys/resource.h>
|
||||
+#elif defined(dragonfly)
|
||||
+#include <kinfo.h>
|
||||
#else
|
||||
#include <sys/dkstat.h>
|
||||
#endif
|
||||
@@ -175,11 +181,18 @@ var_extensible_vmstat(struct variable *v
|
||||
static time_t time_old;
|
||||
static time_t time_diff;
|
||||
|
||||
+#if defined(dragonfly)
|
||||
+ static struct kinfo_cputime cpu_old, cpu_new, cpu_diff;
|
||||
+ static uint64_t cpu_total;
|
||||
+ uint64_t cpu_sum;
|
||||
+ static int pagesize;
|
||||
+#else
|
||||
static long cpu_old[CPUSTATES];
|
||||
static long cpu_new[CPUSTATES];
|
||||
static long cpu_diff[CPUSTATES];
|
||||
static long cpu_total;
|
||||
long cpu_sum;
|
||||
+#endif
|
||||
double cpu_prc;
|
||||
|
||||
static struct vmmeter mem_old, mem_new;
|
||||
@@ -187,6 +200,11 @@ var_extensible_vmstat(struct variable *v
|
||||
static long long_ret;
|
||||
static char errmsg[300];
|
||||
|
||||
+#if defined(dragonfly)
|
||||
+ if (pagesize == 0)
|
||||
+ pagesize = getpagesize() >> 10;
|
||||
+#endif
|
||||
+
|
||||
long_ret = 0; /* set to 0 as default */
|
||||
|
||||
if (header_generic(vp, name, length, exact, var_len, write_method))
|
||||
@@ -202,15 +220,27 @@ var_extensible_vmstat(struct variable *v
|
||||
/*
|
||||
* CPU usage
|
||||
*/
|
||||
- auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
|
||||
+ cpu_total = 0;
|
||||
|
||||
- cpu_total = 0;
|
||||
+#if defined(dragonfly)
|
||||
+ kinfo_get_sched_cputime(&cpu_new);
|
||||
+#define CP_UPDATE(field) cpu_diff.field = cpu_new.field - cpu_old.field; cpu_total += cpu_diff.field;
|
||||
+ CP_UPDATE(cp_user);
|
||||
+ CP_UPDATE(cp_nice);
|
||||
+ CP_UPDATE(cp_sys);
|
||||
+ CP_UPDATE(cp_intr);
|
||||
+ CP_UPDATE(cp_idle);
|
||||
+ cpu_old = cpu_new;
|
||||
+#undef CP_UPDATE
|
||||
+#else
|
||||
+ auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
|
||||
|
||||
for (loop = 0; loop < CPUSTATES; loop++) {
|
||||
cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
|
||||
cpu_old[loop] = cpu_new[loop];
|
||||
cpu_total += cpu_diff[loop];
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (cpu_total == 0)
|
||||
cpu_total = 1;
|
||||
@@ -230,7 +260,11 @@ var_extensible_vmstat(struct variable *v
|
||||
/*
|
||||
* Page-to-kb macro
|
||||
*/
|
||||
+#if defined(dragonfly)
|
||||
+#define ptok(p) ((p) * pagesize)
|
||||
+#else
|
||||
#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
|
||||
+#endif
|
||||
|
||||
switch (vp->magic) {
|
||||
case MIBINDEX:
|
||||
@@ -277,37 +311,73 @@ var_extensible_vmstat(struct variable *v
|
||||
long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPUUSER:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_diff.cp_user + cpu_diff.cp_nice;
|
||||
+#else
|
||||
cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
|
||||
+#endif
|
||||
cpu_prc = (float) cpu_sum / (float) cpu_total;
|
||||
long_ret = cpu_prc * CPU_PRC;
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPUSYSTEM:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_diff.cp_sys + cpu_diff.cp_intr;
|
||||
+#else
|
||||
cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
|
||||
+#endif
|
||||
cpu_prc = (float) cpu_sum / (float) cpu_total;
|
||||
long_ret = cpu_prc * CPU_PRC;
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPUIDLE:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_diff.cp_idle;
|
||||
+#else
|
||||
cpu_sum = cpu_diff[CP_IDLE];
|
||||
+#endif
|
||||
cpu_prc = (float) cpu_sum / (float) cpu_total;
|
||||
long_ret = cpu_prc * CPU_PRC;
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWUSER:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_user;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_USER];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWNICE:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_nice;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_NICE];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWSYSTEM:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_sys + cpu_new.cp_intr;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWIDLE:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_idle;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_IDLE];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWKERNEL:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_sys;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_SYS];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case CPURAWINTR:
|
||||
+#if defined(dragonfly)
|
||||
+ cpu_sum = cpu_new.cp_intr;
|
||||
+#else
|
||||
long_ret = cpu_new[CP_INTR];
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
case SYSRAWINTERRUPTS:
|
||||
long_ret = mem_new.v_intr;
|
|
@ -1,70 +0,0 @@
|
|||
$NetBSD: patch-dn,v 1.3 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig 2008-10-21 21:10:43.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c
|
||||
@@ -10,8 +10,12 @@
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
+#ifdef dragonfly
|
||||
+#include <sys/user.h>
|
||||
+#else
|
||||
#include <sys/proc.h>
|
||||
#include <sys/dkstat.h>
|
||||
+#endif
|
||||
#ifdef freebsd5
|
||||
#include <sys/bio.h>
|
||||
#endif
|
||||
@@ -253,6 +257,10 @@ var_extensible_mem(struct variable *vp,
|
||||
|
||||
static struct vmmeter mem;
|
||||
static struct vmtotal total;
|
||||
+#ifdef dragonfly
|
||||
+ static struct vmstats vmstats;
|
||||
+ size_t vmstats_size = sizeof(vmstats);
|
||||
+#endif
|
||||
size_t total_size = sizeof(total);
|
||||
int total_mib[] = { CTL_VM, VM_METER };
|
||||
|
||||
@@ -286,6 +294,8 @@ var_extensible_mem(struct variable *vp,
|
||||
*/
|
||||
sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
|
||||
|
||||
+ sysctlbyname("vm.vmstats", &vmstats, &vmstats_size, NULL, 0);
|
||||
+
|
||||
#ifdef BUFSPACE_SYMBOL
|
||||
/*
|
||||
* Buffer space
|
||||
@@ -298,7 +308,11 @@ var_extensible_mem(struct variable *vp,
|
||||
/*
|
||||
* Page-to-kb macro
|
||||
*/
|
||||
+#ifdef dragonfly
|
||||
+#define ptok(p) ((p) * (vmstats.v_page_size >> 10))
|
||||
+#else
|
||||
#define ptok(p) ((p) * (mem.v_page_size >> 10))
|
||||
+#endif
|
||||
|
||||
switch (vp->magic) {
|
||||
case MIBINDEX:
|
||||
@@ -318,7 +332,11 @@ var_extensible_mem(struct variable *vp,
|
||||
long_ret = phys_mem >> 10;
|
||||
return ((u_char *) (&long_ret));
|
||||
case MEMAVAILREAL: /* FREE real memory */
|
||||
+#ifdef dragonfly
|
||||
+ long_ret = ptok(vmstats.v_free_count);
|
||||
+#else
|
||||
long_ret = ptok(mem.v_free_count);
|
||||
+#endif
|
||||
return ((u_char *) (&long_ret));
|
||||
|
||||
/*
|
||||
@@ -353,6 +371,8 @@ var_extensible_mem(struct variable *vp,
|
||||
case MEMCACHED:
|
||||
#ifdef darwin
|
||||
long_ret = ptok(mem.v_lookups);
|
||||
+#elif defined(dragonfly)
|
||||
+ long_ret = ptok(vmstats.v_cache_count);
|
||||
#else
|
||||
long_ret = ptok(mem.v_cache_count) + ptok(mem.v_inactive_count);
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-do,v 1.2 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/disk.c.orig 2010-06-16 21:34:42.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c
|
||||
@@ -51,9 +51,11 @@
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
+#if !defined(dragonfly)
|
||||
#ifdef HAVE_SYS_VNODE_H
|
||||
#include <sys/vnode.h>
|
||||
#endif
|
||||
+#endif
|
||||
#ifdef HAVE_UFS_UFS_QUOTA_H
|
||||
#include <ufs/ufs/quota.h>
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-dp,v 1.1 2006/03/19 22:03:29 joerg Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c.orig 2006-03-19 20:40:02.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c
|
||||
@@ -39,9 +39,11 @@
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
+#if !defined(dragonfly)
|
||||
#ifdef HAVE_SYS_VNODE_H
|
||||
#include <sys/vnode.h>
|
||||
#endif
|
||||
+#endif
|
||||
#ifdef HAVE_UFS_UFS_QUOTA_H
|
||||
#include <ufs/ufs/quota.h>
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-dq,v 1.2 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c.orig 2006-03-19 20:41:58.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c
|
||||
@@ -49,9 +49,11 @@
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
+#if !defined(dragonfly)
|
||||
#ifdef HAVE_SYS_VNODE_H
|
||||
#include <sys/vnode.h>
|
||||
#endif
|
||||
+#endif
|
||||
#ifdef HAVE_UFS_UFS_QUOTA_H
|
||||
#include <ufs/ufs/quota.h>
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
$NetBSD: patch-dr,v 1.3 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/tcpTable.c.orig 2010-10-20 13:12:08.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/tcpTable.c
|
||||
@@ -838,7 +838,11 @@ tcpTable_load(netsnmp_cache *cache, void
|
||||
size_t len;
|
||||
int sname[] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_PCBLIST };
|
||||
char *tcpcb_buf = NULL;
|
||||
+#if defined(dragonfly)
|
||||
+ struct xtcpcb *xig = NULL;
|
||||
+#else
|
||||
struct xinpgen *xig = NULL;
|
||||
+#endif
|
||||
netsnmp_inpcb *nnew;
|
||||
int StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
|
||||
|
||||
@@ -860,10 +864,18 @@ tcpTable_load(netsnmp_cache *cache, void
|
||||
* Unpick this into the constituent 'xinpgen' structures, and extract
|
||||
* the 'inpcb' elements into a linked list (built in reverse)
|
||||
*/
|
||||
+#if defined(dragonfly)
|
||||
+ xig = (struct xtcpcb *) tcpcb_buf;
|
||||
+#else
|
||||
xig = (struct xinpgen *) tcpcb_buf;
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
+#endif
|
||||
|
||||
+#if defined(dragonfly)
|
||||
+ while (xig && ((char *)xig + xig->xt_len < tcpcb_buf + len)) {
|
||||
+#else
|
||||
while (xig && (xig->xig_len > sizeof(struct xinpgen))) {
|
||||
+#endif
|
||||
nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
|
||||
if (!nnew)
|
||||
break;
|
||||
@@ -876,7 +888,11 @@ tcpTable_load(netsnmp_cache *cache, void
|
||||
|
||||
nnew->inp_next = tcp_head;
|
||||
tcp_head = nnew;
|
||||
+#if defined(dragonfly)
|
||||
+ xig = (struct xtcpcb *) ((char *) xig + xig->xt_len);
|
||||
+#else
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
+#endif
|
||||
}
|
||||
|
||||
free(tcpcb_buf);
|
|
@ -1,47 +0,0 @@
|
|||
$NetBSD: patch-ds,v 1.5 2011/05/27 10:55:25 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/udpTable.c.orig 2010-03-08 23:07:20.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/udpTable.c
|
||||
@@ -618,7 +618,11 @@ udpTable_load(netsnmp_cache *cache, void
|
||||
size_t len;
|
||||
int sname[] = { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_PCBLIST };
|
||||
char *udpcb_buf = NULL;
|
||||
+#if defined(dragonfly)
|
||||
+ struct xinpcb *xig = NULL;
|
||||
+#else
|
||||
struct xinpgen *xig = NULL;
|
||||
+#endif
|
||||
UDPTABLE_ENTRY_TYPE *nnew;
|
||||
|
||||
udpTable_free(NULL, NULL);
|
||||
@@ -639,10 +643,18 @@ udpTable_load(netsnmp_cache *cache, void
|
||||
* Unpick this into the constituent 'xinpgen' structures, and extract
|
||||
* the 'inpcb' elements into a linked list (built in reverse)
|
||||
*/
|
||||
+#if defined(dragonfly)
|
||||
+ xig = (struct xinpcb *) udpcb_buf;
|
||||
+#else
|
||||
xig = (struct xinpgen *) udpcb_buf;
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
+#endif
|
||||
|
||||
+#if defined(dragonfly)
|
||||
+ while (xig && ((char *)xig + xig->xi_len < udpcb_buf + len)) {
|
||||
+#else
|
||||
while (xig && (xig->xig_len > sizeof(struct xinpgen))) {
|
||||
+#endif
|
||||
nnew = SNMP_MALLOC_TYPEDEF(UDPTABLE_ENTRY_TYPE);
|
||||
if (!nnew)
|
||||
break;
|
||||
@@ -655,7 +667,11 @@ udpTable_load(netsnmp_cache *cache, void
|
||||
#endif
|
||||
|
||||
udp_head = nnew;
|
||||
+#if defined(dragonfly)
|
||||
+ xig = (struct xinpcb *) ((char *) xig + xig->xi_len);
|
||||
+#else
|
||||
xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
|
||||
+#endif
|
||||
}
|
||||
|
||||
free(udpcb_buf);
|
|
@ -1,12 +1,12 @@
|
|||
$NetBSD: patch-dt,v 1.9 2013/03/12 03:00:38 garbled Exp $
|
||||
$NetBSD: patch-dt,v 1.10 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/Makefile.in.orig 2010-06-08 14:05:11.000000000 -0700
|
||||
+++ agent/Makefile.in 2013-03-11 13:16:27.000000000 -0700
|
||||
@@ -253,7 +253,7 @@
|
||||
--- agent/Makefile.in.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/Makefile.in
|
||||
@@ -301,7 +301,7 @@ libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VE
|
||||
$(RANLIB) $(AGENTLIB)
|
||||
|
||||
libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION): ${LMIBOBJS} $(AGENTLIB) $(USELIBS)
|
||||
- $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(AGENTLIB) $(USELIBS) @LD_NO_UNDEFINED@ $(LDFLAGS) ${LMIBLIBS} $(LIB_LD_LIBS) @AGENTLIBS@
|
||||
- $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(AGENTLIB) $(USELIBS) @LD_NO_UNDEFINED@ $(LDFLAGS) ${LMIBLIBS} $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) @AGENTLIBS@
|
||||
+ $(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(AGENTLIB) $(USELIBS) @LD_NO_UNDEFINED@ $(LDFLAGS) ${LMIBLIBS} $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) ${MIB_SYSTEM_LIBS} @AGENTLIBS@
|
||||
$(RANLIB) $(MIBLIB)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-du,v 1.2 2008/09/08 12:58:09 adam Exp $
|
||||
$NetBSD: patch-du,v 1.3 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2008-05-28 13:48:46.000000000 +0200
|
||||
--- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/hardware/memory/memory_freebsd.c
|
||||
@@ -36,6 +36,12 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
||||
long pagesize;
|
||||
|
@ -12,11 +12,11 @@ $NetBSD: patch-du,v 1.2 2008/09/08 12:58:09 adam Exp $
|
|||
+ size_t vmem_size = sizeof(struct vmmeter);
|
||||
+#endif
|
||||
+
|
||||
struct vmmeter vmem;
|
||||
struct vmtotal total;
|
||||
size_t total_size = sizeof(total);
|
||||
@@ -58,12 +64,18 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
||||
sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0);
|
||||
int total_mib[] = { CTL_VM, VM_METER };
|
||||
@@ -65,11 +71,17 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
||||
sysctlbyname("vm.stats.vm.v_inactive_count", &inact_count, &inact_size, NULL, 0);
|
||||
sysctlbyname("vfs.bufspace", &bufspace, &buf_size, NULL, 0);
|
||||
sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0);
|
||||
+#ifdef dragonfly
|
||||
|
@ -24,7 +24,6 @@ $NetBSD: patch-du,v 1.2 2008/09/08 12:58:09 adam Exp $
|
|||
+ sysctlbyname("vm.vmstats", &vms, &vms_size, NULL, 0);
|
||||
+ sysctlbyname("vm.vmmeter", &vmem, &vmem_size, NULL, 0);
|
||||
+#else
|
||||
auto_nlist(SUM_SYMBOL, (char *) &vmem, sizeof(vmem));
|
||||
#ifndef freebsd4
|
||||
pagesize = 1024;
|
||||
#else
|
||||
|
@ -34,19 +33,19 @@ $NetBSD: patch-du,v 1.2 2008/09/08 12:58:09 adam Exp $
|
|||
|
||||
/*
|
||||
* ... and save this in a standard form.
|
||||
@@ -129,9 +141,15 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
||||
@@ -80,9 +92,15 @@ int netsnmp_mem_arch_load( netsnmp_cache
|
||||
} else {
|
||||
if (!mem->descr)
|
||||
mem->descr = strdup("Cached memory");
|
||||
mem->descr = strdup("Physical memory");
|
||||
+#ifdef dragonfly
|
||||
+ mem->units = vms.v_page_size;
|
||||
+ mem->size = vms.v_cache_max;
|
||||
+ mem->free = vms.v_cache_max - vms.v_cache_count;
|
||||
+#else
|
||||
mem->units = vmem.v_page_size;
|
||||
mem->size = vmem.v_cache_max;
|
||||
mem->free = vmem.v_cache_max - vmem.v_cache_count;
|
||||
mem->units = pagesize;
|
||||
mem->size = phys_mem/pagesize;
|
||||
mem->free = total.t_free;
|
||||
+#endif
|
||||
}
|
||||
|
||||
nswap = swapmode(pagesize);
|
||||
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: patch-el,v 1.3 2011/05/27 10:55:26 adam Exp $
|
||||
$NetBSD: patch-el,v 1.4 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- perl/OID/OID.xs.orig 2011-02-01 14:34:03.000000000 +0000
|
||||
--- perl/OID/OID.xs.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ perl/OID/OID.xs
|
||||
@@ -156,17 +156,22 @@ MODULE = NetSNMP::OID PACKAGE = NetSNMP
|
||||
@@ -157,17 +157,22 @@ MODULE = NetSNMP::OID PACKAGE = NetSNMP
|
||||
netsnmp_oid *
|
||||
nso_newptr(initstring)
|
||||
char *initstring
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-es,v 1.2 2011/05/27 10:55:26 adam Exp $
|
||||
$NetBSD: patch-es,v 1.3 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/memory_netbsd1.c.orig 2008-10-21 21:10:43.000000000 +0000
|
||||
--- agent/mibgroup/ucd-snmp/memory_netbsd1.c.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ agent/mibgroup/ucd-snmp/memory_netbsd1.c
|
||||
@@ -165,7 +165,7 @@ var_extensible_mem(struct variable *vp,
|
||||
static char errmsg[1024];
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
$NetBSD: patch-et,v 1.6 2011/05/27 10:55:26 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/icmp.c.orig 2011-02-01 14:16:23.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/icmp.c
|
||||
@@ -567,6 +567,12 @@ init_icmp(void)
|
||||
*
|
||||
*********************/
|
||||
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#define ICMP_STAT_STRUCTURE struct icmp_mib
|
||||
+#define USES_SNMP_DESIGNED_ICMPSTAT
|
||||
+#undef ICMP_NSTATS
|
||||
+#endif
|
||||
+
|
||||
#ifdef hpux11
|
||||
#define ICMP_STAT_STRUCTURE int
|
||||
#endif
|
||||
@@ -1289,6 +1295,21 @@ icmp_load(netsnmp_cache *cache, void *vm
|
||||
}
|
||||
return ret_value;
|
||||
}
|
||||
+#elif defined(NETBSD_STATS_VIA_SYSCTL)
|
||||
+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)
|
|
@ -1,39 +0,0 @@
|
|||
$NetBSD: patch-eu,v 1.3 2011/05/27 10:55:26 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/ip.c.orig 2011-02-01 14:15:54.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/ip.c
|
||||
@@ -214,6 +214,12 @@ init_ip(void)
|
||||
*
|
||||
*********************/
|
||||
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#define IP_STAT_STRUCTURE struct ip_mib
|
||||
+#define USES_SNMP_DESIGNED_IPSTAT
|
||||
+#undef IP_NSTATS
|
||||
+#endif
|
||||
+
|
||||
#ifdef hpux11
|
||||
#define IP_STAT_STRUCTURE int
|
||||
#endif
|
||||
@@ -827,6 +833,21 @@ ip_load(netsnmp_cache *cache, void *vmag
|
||||
}
|
||||
return ret_value;
|
||||
}
|
||||
+#elif defined (NETBSD_STATS_VIA_SYSCTL)
|
||||
+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)
|
|
@ -1,203 +0,0 @@
|
|||
$NetBSD: patch-ev,v 1.2 2010/11/17 00:59:06 taca Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/kernel_netbsd.c.orig 2010-10-19 03:54:58.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/kernel_netbsd.c
|
||||
@@ -0,0 +1,198 @@
|
||||
+/*
|
||||
+ * 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"
|
||||
+
|
||||
+#if defined(NETBSD_STATS_VIA_SYSCTL)
|
||||
+
|
||||
+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;
|
||||
+}
|
||||
+
|
||||
+#endif
|
|
@ -1,96 +0,0 @@
|
|||
$NetBSD: patch-ew,v 1.2 2010/11/17 00:59:06 taca 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 defined(NETBSD_STATS_VIA_SYSCTL)
|
||||
+
|
||||
+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_STATS_VIA_SYSCTL */
|
||||
+
|
||||
+#endif /* _MIBGROUP_KERNEL_NETBSD_H */
|
|
@ -1,14 +0,0 @@
|
|||
$NetBSD: patch-ex,v 1.3 2011/05/27 10:55:26 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/mibII_common.h.orig 2006-09-15 00:48:50.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/mibII_common.h
|
||||
@@ -97,6 +97,9 @@
|
||||
#ifdef linux
|
||||
#include "kernel_linux.h"
|
||||
#endif
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#include "kernel_netbsd.h"
|
||||
+#endif
|
||||
/* or MIB_xxxCOUNTER_SYMBOL || hpux11 */
|
||||
#ifdef hpux
|
||||
#include <sys/mib.h>
|
|
@ -1,39 +0,0 @@
|
|||
$NetBSD: patch-ey,v 1.4 2011/05/27 10:55:26 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/tcp.c.orig 2011-02-01 14:23:55.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/tcp.c
|
||||
@@ -155,6 +155,12 @@ init_tcp(void)
|
||||
*
|
||||
*********************/
|
||||
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#define TCP_STAT_STRUCTURE struct tcp_mib
|
||||
+#define USES_SNMP_DESIGNED_TCPSTAT
|
||||
+#undef TCP_NSTATS
|
||||
+#endif
|
||||
+
|
||||
#ifdef hpux11
|
||||
#define TCP_STAT_STRUCTURE int
|
||||
#endif
|
||||
@@ -766,6 +772,21 @@ tcp_load(netsnmp_cache *cache, void *vma
|
||||
}
|
||||
return ret_value;
|
||||
}
|
||||
+#elif defined(NETBSD_STATS_VIA_SYSCTL)
|
||||
+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)
|
|
@ -1,50 +0,0 @@
|
|||
$NetBSD: patch-ez,v 1.3 2011/05/27 10:55:26 adam Exp $
|
||||
|
||||
--- agent/mibgroup/mibII/udp.c.orig 2011-02-01 14:16:09.000000000 +0000
|
||||
+++ agent/mibgroup/mibII/udp.c
|
||||
@@ -30,6 +30,10 @@
|
||||
#include "kernel_linux.h"
|
||||
#endif
|
||||
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#include "kernel_netbsd.h"
|
||||
+#endif
|
||||
+
|
||||
#ifdef cygwin
|
||||
#define WIN32
|
||||
#include <windows.h>
|
||||
@@ -137,6 +141,12 @@ init_udp(void)
|
||||
*
|
||||
*********************/
|
||||
|
||||
+#ifdef NETBSD_STATS_VIA_SYSCTL
|
||||
+#define UDP_STAT_STRUCTURE struct udp_mib
|
||||
+#define USES_SNMP_DESIGNED_UDPSTAT
|
||||
+#undef UDP_NSTATS
|
||||
+#endif
|
||||
+
|
||||
#ifdef hpux11
|
||||
#define UDP_STAT_STRUCTURE int
|
||||
#endif
|
||||
@@ -467,6 +477,21 @@ udp_load(netsnmp_cache *cache, void *vma
|
||||
}
|
||||
return ret_value;
|
||||
}
|
||||
+#elif defined(NETBSD_STATS_VIA_SYSCTL)
|
||||
+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)
|
|
@ -1,19 +1,18 @@
|
|||
$NetBSD: patch-fa,v 1.4 2011/10/17 19:40:26 shattered Exp $
|
||||
$NetBSD: patch-fa,v 1.5 2013/03/17 00:15:29 gdt Exp $
|
||||
|
||||
--- include/net-snmp/system/netbsd.h.orig 2009-04-09 08:48:32.000000000 +0000
|
||||
--- include/net-snmp/system/netbsd.h.orig 2012-10-09 22:28:58.000000000 +0000
|
||||
+++ include/net-snmp/system/netbsd.h
|
||||
@@ -38,6 +38,14 @@
|
||||
# define netbsd1 netbsd1
|
||||
#endif
|
||||
@@ -68,6 +68,13 @@
|
||||
|
||||
+#if __NetBSD_Version__ >= 499005800
|
||||
+#define NETBSD_STATS_VIA_SYSCTL
|
||||
#if __NetBSD_Version__ >= 499005800
|
||||
#define NETBSD_STATS_VIA_SYSCTL
|
||||
+
|
||||
+/* Why these undefs? */
|
||||
+#undef IPSTAT_SYMBOL
|
||||
+#undef ICMPSTAT_SYMBOL
|
||||
+#undef TCPSTAT_SYMBOL
|
||||
+#undef UDPSTAT_SYMBOL
|
||||
+#endif /* __NetBSD_Version__ >= 499005800 */
|
||||
+
|
||||
#endif /* __NetBSD_Version__ >= 499005800 */
|
||||
|
||||
/* define the extra mib modules that are supported */
|
||||
#define NETSNMP_INCLUDE_HOST_RESOURCES
|
||||
#define NETSNMP_INCLUDE_IFTABLE_REWRITES
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
$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"
|
|
@ -1,40 +0,0 @@
|
|||
$NetBSD: patch-fc,v 1.1 2010/12/22 08:13:30 sekiya Exp $
|
||||
|
||||
--- agent/mibgroup/ucd-snmp/vmstat.c.orig 2010-12-22 15:46:31.000000000 +0900
|
||||
+++ agent/mibgroup/ucd-snmp/vmstat.c 2010-12-22 15:48:47.000000000 +0900
|
||||
@@ -129,7 +129,10 @@
|
||||
case CPUUSER:
|
||||
if ( info->history && info->history[0].total_hist ) {
|
||||
value = (info->user_ticks - info->history[0].user_hist)*100;
|
||||
- value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ if (info->total_ticks > info->history[0].total_hist)
|
||||
+ value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ else
|
||||
+ value = 0;
|
||||
snmp_set_var_typed_integer(requests->requestvb,
|
||||
ASN_INTEGER, value);
|
||||
}
|
||||
@@ -138,7 +141,10 @@
|
||||
if ( info->history && info->history[0].total_hist ) {
|
||||
/* or sys2_ticks ??? */
|
||||
value = (info->sys_ticks - info->history[0].sys_hist)*100;
|
||||
- value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ if (info->total_ticks > info->history[0].total_hist)
|
||||
+ value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ else
|
||||
+ value = 0;
|
||||
snmp_set_var_typed_integer(requests->requestvb,
|
||||
ASN_INTEGER, value);
|
||||
}
|
||||
@@ -146,7 +152,10 @@
|
||||
case CPUIDLE:
|
||||
if ( info->history && info->history[0].total_hist ) {
|
||||
value = (info->idle_ticks - info->history[0].idle_hist)*100;
|
||||
- value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ if (info->total_ticks > info->history[0].total_hist)
|
||||
+ value /= (info->total_ticks - info->history[0].total_hist);
|
||||
+ else
|
||||
+ value = 0;
|
||||
snmp_set_var_typed_integer(requests->requestvb,
|
||||
ASN_INTEGER, value);
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
$NetBSD: patch-fd,v 1.2 2013/01/11 13:34:46 joerg Exp $
|
||||
|
||||
--- agent/mibgroup/hardware/cpu/cpu_sysctl.c.orig 2010-06-12 21:33:30.000000000 +0000
|
||||
+++ agent/mibgroup/hardware/cpu/cpu_sysctl.c
|
||||
@@ -19,6 +19,9 @@
|
||||
#else
|
||||
#include <sys/sched.h>
|
||||
#endif
|
||||
+#if defined(__NetBSD__)
|
||||
+#include <uvm/uvm_extern.h>
|
||||
+#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
@@ -49,7 +52,11 @@ void init_cpu_sysctl( void ) {
|
||||
if ( n <= 0 )
|
||||
n = 1; /* Single CPU system */
|
||||
i = sizeof(descr);
|
||||
+#if defined(__NetBSD__) && ( defined(__i386__) || defined(__x86_64__) )
|
||||
+ sysctlbyname("machdep.cpu_brand", descr, (void *)&i, NULL, 0);
|
||||
+#else
|
||||
sysctl(model_mib, 2, descr, (void *)&i, NULL, 0);
|
||||
+#endif
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
cpu = netsnmp_cpu_get_byIdx( i, 1 );
|
||||
cpu->status = 2; /* running */
|
||||
@@ -59,26 +66,22 @@ void init_cpu_sysctl( void ) {
|
||||
cpu_num = n;
|
||||
}
|
||||
|
||||
-
|
||||
+#if defined(__NetBSD__)
|
||||
+#define NETSNMP_CPU_STATS uint64_t
|
||||
+#define NETSNMP_KERN_CPU KERN_CP_TIME
|
||||
+#else
|
||||
#define NETSNMP_CPU_STATS long
|
||||
#if defined(KERN_CPUSTATS) /* BSDi */
|
||||
#define NETSNMP_KERN_CPU KERN_CPUSTATS
|
||||
#elif defined(KERN_CPTIME) /* OpenBSD */
|
||||
#define NETSNMP_KERN_CPU KERN_CPTIME
|
||||
-#elif defined(KERN_CP_TIME) /* NetBSD */
|
||||
-#define NETSNMP_KERN_CPU KERN_CP_TIME
|
||||
-
|
||||
-#if defined(netbsdelf3)
|
||||
-#undef NETSNMP_CPU_STATS
|
||||
-#define NETSNMP_CPU_STATS uint64_t
|
||||
-#endif
|
||||
-
|
||||
#elif defined(__FreeBSD__)
|
||||
#define NETSNMP_KERN_CPU 0 /* dummy value - sysctlnametomib(2) should be used */
|
||||
|
||||
#else
|
||||
#error "No CPU statistics sysctl token"
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/*
|
||||
Need to check details before enabling this!
|
||||
@@ -159,7 +162,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache
|
||||
size_t mem_size = sizeof(NETSNMP_VM_STATS_TYPE);
|
||||
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
|
||||
|
||||
-#if defined(__FreeBSD__)
|
||||
+#if defined(__FreeBSD__) || defined (__NetBSD__)
|
||||
sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
|
||||
#else
|
||||
sysctl(cpu_mib, 2, cpu_stats, &cpu_size, NULL, 0);
|
Loading…
Reference in a new issue