[PATCH] iphlpapi: Add missing header to configure test.

Charles Davis cdavis5x at gmail.com
Sun Feb 12 04:01:51 CST 2017


This lets GetIcmpStatistics() work again on FreeBSD.

Signed-off-by: Charles Davis <cdavis5x at gmail.com>
---
 configure.ac            | 3 +++
 dlls/iphlpapi/ipstats.c | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c6d63b2cb357..993475f1ed59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2374,6 +2374,9 @@ AC_CHECK_MEMBERS([struct icmpstat.icps_inhist],,,
 [#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
 #ifdef HAVE_NETINET_IP_H
 #include <netinet/ip.h>
 #endif
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 5965bf9dae69..47df7ebfde52 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -510,7 +510,7 @@ DWORD WINAPI GetIcmpStatistics(PMIB_ICMP stats)
         }
         if (kc) kstat_close( kc );
     }
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS) && defined(HAVE_STRUCT_ICMPSTAT_ICPS_INHIST)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS) && (defined(HAVE_STRUCT_ICMPSTAT_ICPS_INHIST) || defined(HAVE_STRUCT_ICMPSTAT_ICPS_OUTHIST))
     {
         int mib[] = {CTL_NET, PF_INET, IPPROTO_ICMP, ICMPCTL_STATS};
 #define MIB_LEN (sizeof(mib) / sizeof(mib[0]))
@@ -520,6 +520,7 @@ DWORD WINAPI GetIcmpStatistics(PMIB_ICMP stats)
 
         if(sysctl(mib, MIB_LEN, &icmp_stat, &needed, NULL, 0) != -1)
         {
+#ifdef HAVE_STRUCT_ICMPSTAT_ICPS_INHIST
             /*in stats */
             stats->stats.icmpInStats.dwMsgs = icmp_stat.icps_badcode + icmp_stat.icps_checksum + icmp_stat.icps_tooshort + icmp_stat.icps_badlen;
             for(i = 0; i <= ICMP_MAXTYPE; i++)
@@ -538,6 +539,7 @@ DWORD WINAPI GetIcmpStatistics(PMIB_ICMP stats)
             stats->stats.icmpInStats.dwTimestampReps = icmp_stat.icps_inhist[ICMP_TSTAMPREPLY];
             stats->stats.icmpInStats.dwAddrMasks = icmp_stat.icps_inhist[ICMP_MASKREQ];
             stats->stats.icmpInStats.dwAddrMaskReps = icmp_stat.icps_inhist[ICMP_MASKREPLY];
+#endif
 
 #ifdef HAVE_STRUCT_ICMPSTAT_ICPS_OUTHIST
             /* out stats */
-- 
2.11.1




More information about the wine-patches mailing list