From 99d247ad5af0747c619f1a7e9b75fcfdf3d36fd2 Mon Sep 17 00:00:00 2001 From: Charles Davis Date: Sun, 12 Feb 2017 02:01:51 -0800 Subject: [PATCH] iphlpapi: Add missing header to configure test. This lets GetIcmpStatistics() work again on FreeBSD. Signed-off-by: Charles Davis Signed-off-by: Alexandre Julliard --- configure | 3 +++ configure.ac | 3 +++ dlls/iphlpapi/ipstats.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure b/configure index a7e350e534d..b2abca4cd79 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 #endif +#ifdef HAVE_NETINET_IN_H +#include +#endif #ifdef HAVE_NETINET_IP_H #include #endif diff --git a/configure.ac b/configure.ac index 413bfc98742..8bffab9c800 100644 --- a/configure.ac +++ b/configure.ac @@ -2380,6 +2380,9 @@ AC_CHECK_MEMBERS([struct icmpstat.icps_inhist],,, [#ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef HAVE_NETINET_IN_H +#include +#endif #ifdef HAVE_NETINET_IP_H #include #endif diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 5965bf9dae6..47df7ebfde5 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 */