pkgsrc/net/net-snmp/patches/patch-dr

47 lines
1.5 KiB
Text

$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);