From 0a70e1ac63f0f378d2ebf16aa165f38aece720ef Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Fri, 15 Apr 2022 19:28:15 -0500 Subject: [PATCH] configure: Check for struct icmpstat. NetBSD no longer has statistics structures. Instead, it stores them as arrays of integer counters. It's backwards compatible with the old statistics structures, but the struct definitions are missing. This has likely been broken on NetBSD for quite some time as a result. Signed-off-by: Alexandre Julliard --- configure | 26 ++++++++++++++++++++++++++ configure.ac | 19 +++++++++++++++++++ dlls/nsiproxy.sys/ip.c | 2 +- include/config.h.in | 3 +++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/configure b/configure index f77409da444..5eff6d59592 100755 --- a/configure +++ b/configure @@ -20619,6 +20619,32 @@ printf "%s\n" "#define HAVE_STRUCT_IP_STATS_IPS_TOTAL 1" >>confdefs.h fi +ac_fn_c_check_member "$LINENO" "struct icmpstat" "icps_error" "ac_cv_member_struct_icmpstat_icps_error" "#include +#ifdef HAVE_SYS_SOCKETVAR_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_IP_H +#include +#endif +#ifdef HAVE_NETINET_IP_ICMP_H +#include +#endif +#ifdef HAVE_NETINET_ICMP_VAR_H +#include +#endif +" +if test "x$ac_cv_member_struct_icmpstat_icps_error" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_ICMPSTAT_ICPS_ERROR 1" >>confdefs.h + + +fi + + ac_fn_c_check_member "$LINENO" "struct tcpstat" "tcps_connattempt" "ac_cv_member_struct_tcpstat_tcps_connattempt" "#include #ifdef HAVE_SYS_SOCKETVAR_H #include diff --git a/configure.ac b/configure.ac index 630f0563527..5036857db71 100644 --- a/configure.ac +++ b/configure.ac @@ -2218,6 +2218,25 @@ AC_CHECK_MEMBERS([struct ip_stats.ips_total],,, #include #endif]) +dnl Check for struct icmpstat +AC_CHECK_MEMBERS([struct icmpstat.icps_error],,, +[#include +#ifdef HAVE_SYS_SOCKETVAR_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_IP_H +#include +#endif +#ifdef HAVE_NETINET_IP_ICMP_H +#include +#endif +#ifdef HAVE_NETINET_ICMP_VAR_H +#include +#endif]) + dnl Check for struct tcpstat AC_CHECK_MEMBERS([struct tcpstat.tcps_connattempt],,, [#include diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c index b8fff704f38..69f286a41a0 100644 --- a/dlls/nsiproxy.sys/ip.c +++ b/dlls/nsiproxy.sys/ip.c @@ -299,7 +299,7 @@ static NTSTATUS ipv4_icmpstats_get_all_parameters( const void *key, UINT key_siz fclose( fp ); return status; } -#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS) +#elif defined(HAVE_SYS_SYSCTL_H) && defined(ICMPCTL_STATS) && defined(HAVE_STRUCT_ICMPSTAT_ICPS_ERROR) { int mib[] = { CTL_NET, PF_INET, IPPROTO_ICMP, ICMPCTL_STATS }; struct icmpstat icmp_stat; diff --git a/include/config.h.in b/include/config.h.in index 45a0bd07abb..bc5ecdebc91 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -443,6 +443,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if `icps_error' is a member of `struct icmpstat'. */ +#undef HAVE_STRUCT_ICMPSTAT_ICPS_ERROR + /* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ #undef HAVE_STRUCT_IFREQ_IFR_HWADDR