summaryrefslogtreecommitdiff
path: root/net/net-snmp/patches/patch-ez
blob: 8d5d89e0fadad7548540424fca49d1ceb302dc92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$NetBSD: patch-ez,v 1.1 2010/05/11 04:39:54 adam Exp $

--- agent/mibgroup/mibII/udp.c.orig	2010-03-12 00:32:31.000000000 +0000
+++ agent/mibgroup/mibII/udp.c	2010-03-12 00:34:17.000000000 +0000
@@ -29,6 +29,10 @@
 #include "kernel_linux.h"
 #endif
 
+#ifdef netbsd4
+#include "kernel_netbsd.h"
+#endif
+
 #ifdef cygwin
 #define WIN32
 #include <windows.h>
@@ -149,6 +153,12 @@
 #define USES_SNMP_DESIGNED_UDPSTAT
 #endif
 
+#ifdef netbsd4
+#define UDP_STAT_STRUCTURE      struct udp_mib
+#define USES_SNMP_DESIGNED_UDPSTAT
+#undef UDP_NSTATS
+#endif
+
 #ifdef WIN32
 #include <iphlpapi.h>
 #define UDP_STAT_STRUCTURE MIB_UDPSTATS
@@ -469,6 +479,21 @@
     }
     return ret_value;
 }
+#elif defined(netbsd4)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+    long ret_value = -1;
+
+    ret_value = netbsd_read_udp_stat(&udpstat);
+
+    if ( ret_value < 0 ) {
+        DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (netbsd)\n"));
+    } else {
+        DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (netbsd)\n"));
+    }
+    return ret_value;
+}
 #elif defined(WIN32)
 int
 udp_load(netsnmp_cache *cache, void *vmagic)