$NetBSD: patch-ds,v 1.4 2008/09/08 12:58:09 adam Exp $ --- agent/mibgroup/mibII/udpTable.c.orig 2008-02-13 17:12:42.000000000 +0100 +++ agent/mibgroup/mibII/udpTable.c @@ -619,7 +619,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); @@ -640,10 +644,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; @@ -656,7 +668,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);