summaryrefslogtreecommitdiff
path: root/net/net-snmp/patches/patch-dr
blob: e6a9a2c1e0357d073b1e8a917c529c1a61fa1490 (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-dr,v 1.1 2006/03/19 22:03:29 joerg Exp $

--- agent/mibgroup/mibII/tcpTable.c.orig	2006-03-19 21:24:04.000000000 +0000
+++ agent/mibgroup/mibII/tcpTable.c
@@ -711,7 +711,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 };
 
@@ -733,10 +737,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;
@@ -749,7 +761,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);