From: Florian Forster Date: Thu, 11 Jun 2015 06:46:54 +0000 (+0100) Subject: dns plugin: Check for "struct ip6_ext". X-Git-Tag: collectd-5.5.1~116^2~7 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=21ba59f8197dba0a72dbf5186bc0a5d7e5074496;p=collectd.git dns plugin: Check for "struct ip6_ext". Solaris appears to declare the struct, but only when The Right defines are specified at compile time. As a quick and dirty fix, only build with IPv6 support when the struct is usable. Fixes: #348 --- diff --git a/configure.ac b/configure.ac index 554a58bf..8572749f 100644 --- a/configure.ac +++ b/configure.ac @@ -276,6 +276,24 @@ AC_CHECK_HEADERS(netinet/udp.h, [], [], #endif ]) +AC_CHECK_TYPES([struct ip6_ext], [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP6_H +# include +#endif +]) + # For cpu modules AC_CHECK_HEADERS(sys/dkstat.h) if test "x$ac_system" = "xDarwin" diff --git a/src/utils_dns.c b/src/utils_dns.c index 655c61ed..fcc65a56 100644 --- a/src/utils_dns.c +++ b/src/utils_dns.c @@ -129,6 +129,10 @@ # error "`struct udphdr' is unusable." #endif +#if HAVE_NETINET_IP6_H && HAVE_STRUCT_IP6_EXT +# define HAVE_IPV6 1 +#endif + #include "utils_dns.h" /* @@ -444,7 +448,7 @@ handle_udp(const struct udphdr *udp, int len) return 1; } -#if HAVE_NETINET_IP6_H +#if HAVE_IPV6 static int handle_ipv6 (struct ip6_hdr *ipv6, int len) { @@ -513,16 +517,16 @@ handle_ipv6 (struct ip6_hdr *ipv6, int len) return (1); /* Success */ } /* int handle_ipv6 */ -/* #endif HAVE_NETINET_IP6_H */ +/* #endif HAVE_IPV6 */ -#else /* if !HAVE_NETINET_IP6_H */ +#else /* if !HAVE_IPV6 */ static int handle_ipv6 (__attribute__((unused)) void *pkg, __attribute__((unused)) int len) { return (0); } -#endif /* !HAVE_NETINET_IP6_H */ +#endif /* !HAVE_IPV6 */ static int handle_ip(const struct ip *ip, int len)