summaryrefslogtreecommitdiff
path: root/net/net-snmp/patches/patch-ds
blob: b15fc4c324af9a7b0edd657bc021f506b5873ead (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.2 2006/07/29 16:48:27 adam Exp $

--- agent/mibgroup/mibII/udpTable.c.orig	2006-06-27 17:25:38.000000000 +0200
+++ agent/mibgroup/mibII/udpTable.c
@@ -615,7 +615,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);
@@ -636,10 +640,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;
@@ -652,7 +664,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);