$NetBSD: patch-ad,v 1.7 2012/05/23 17:48:54 marino Exp $

--- dlls/iphlpapi/ipstats.c.orig	2010-12-10 22:33:07.000000000 +0300
+++ dlls/iphlpapi/ipstats.c
@@ -27,6 +27,10 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+#include <unistd.h>
 #ifdef HAVE_ALIAS_H
 #include <alias.h>
 #endif
@@ -489,7 +493,7 @@ DWORD WINAPI GetIcmpStatistics(PMIB_ICMP
         }
         if (kc) kstat_close( kc );
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS) && !defined(__NetBSD__)
     {
         int mib[] = {CTL_NET, PF_INET, IPPROTO_ICMP, ICMPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
@@ -655,7 +659,9 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTAT
         }
         if (kc) kstat_close( kc );
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(IPCTL_STATS) \
+  && !defined(__NetBSD__) \
+  && !defined(__DragonFly__)
     {
         int mib[] = {CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
@@ -804,7 +810,9 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPST
         }
         if (kc) kstat_close( kc );
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(UDPCTL_STATS)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(UDPCTL_STATS) \
+  && !defined(__NetBSD__) \
+  && !defined(__DragonFly__)
     {
 #ifndef TCPTV_MIN  /* got removed in Mac OS X for some reason */
 #define TCPTV_MIN 2
@@ -915,7 +923,7 @@ DWORD WINAPI GetUdpStatistics(PMIB_UDPST
         }
         if (kc) kstat_close( kc );
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(UDPCTL_STATS)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(UDPCTL_STATS) && !defined(__NetBSD__)
     {
         int mib[] = {CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
@@ -1347,7 +1355,7 @@ DWORD WINAPI AllocateAndGetIpNetTableFro
         }
         else ret = ERROR_NOT_SUPPORTED;
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) && !defined(__NetBSD__)
     {
       int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
