Charles Davis : iphlpapi: Add missing header to configure test.

Alexandre Julliard julliard at winehq.org
Mon Feb 13 15:24:38 CST 2017


Module: wine
Branch: master
Commit: 99d247ad5af0747c619f1a7e9b75fcfdf3d36fd2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=99d247ad5af0747c619f1a7e9b75fcfdf3d36fd2

Author: Charles Davis <cdavis5x at gmail.com>
Date:   Sun Feb 12 02:01:51 2017 -0800

iphlpapi: Add missing header to configure test.

This lets GetIcmpStatistics() work again on FreeBSD.

Signed-off-by: Charles Davis <cdavis5x at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure               | 3 +++
 configure.ac            | 3 +++
 dlls/iphlpapi/ipstats.c | 4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index a7e350e..b2abca4 100755
--- a/configure
+++ b/configure
@@ -16768,6 +16768,9 @@ fi
 ac_fn_c_check_member "$LINENO" "struct icmpstat" "icps_inhist" "ac_cv_member_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/configure.ac b/configure.ac
index 413bfc9..8bffab9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2380,6 +2380,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 5965bf9..47df7eb 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 */




More information about the wine-cvs mailing list