summaryrefslogtreecommitdiff
path: root/net/net-snmp/patches/patch-ds
blob: 1932a29eb5a79f8f0bdb9367b75a2e82d9022233 (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
$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);