$NetBSD: patch-eu,v 1.1.4.1 2010/11/28 14:04:37 tron Exp $

--- agent/mibgroup/mibII/ip.c.orig	2010-10-19 03:54:57.000000000 +0000
+++ agent/mibgroup/mibII/ip.c
@@ -199,6 +199,12 @@ init_ip(void)
 #define	USES_SNMP_DESIGNED_IPSTAT
 #endif
 
+#ifdef NETBSD_STATS_VIA_SYSCTL
+#define IP_STAT_STRUCTURE	struct ip_mib
+#define USES_SNMP_DESIGNED_IPSTAT
+#undef IP_NSTATS
+#endif
+
 #if defined (WIN32) || defined (cygwin)
 #include <iphlpapi.h>
 #define IP_STAT_STRUCTURE MIB_IPSTATS
@@ -804,6 +810,21 @@ 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)
