[Nagiosplug-checkins] SF.net SVN: nagiosplug: [1794] nagiosplug/trunk

hweiss at users.sourceforge.net hweiss at users.sourceforge.net
Mon Sep 24 02:30:17 CEST 2007


Revision: 1794
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1794&view=rev
Author:   hweiss
Date:     2007-09-23 17:30:14 -0700 (Sun, 23 Sep 2007)

Log Message:
-----------
Let ./configure --without-ipv6 suppress non-IPv4 DNS lookups (noted by
Mark Frost on nagios-users@)

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/configure.in
    nagiosplug/trunk/plugins/netutils.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2007-09-23 12:29:36 UTC (rev 1793)
+++ nagiosplug/trunk/NEWS	2007-09-24 00:30:14 UTC (rev 1794)
@@ -30,6 +30,7 @@
 	The "negate" utility can now remap custom states
 	Check_radius now supports radiusclient-ng
 	Check_by_ssh now supports multiline output
+	IPv6 support can now be disabled using ./configure --without-ipv6
 
 1.4.9 4th June 2006
 	Inclusion of contrib/check_cluster2 as check_cluster with some improvements

Modified: nagiosplug/trunk/configure.in
===================================================================
--- nagiosplug/trunk/configure.in	2007-09-23 12:29:36 UTC (rev 1793)
+++ nagiosplug/trunk/configure.in	2007-09-24 00:30:14 UTC (rev 1794)
@@ -275,9 +275,15 @@
   AC_SUBST(MYSQLCFLAGS)
 fi
 
+AC_ARG_WITH([ipv6],
+	[AS_HELP_STRING([--with-ipv6], [support IPv6 @<:@default=check@:>@])],
+	[], [with_ipv6=check])
+
 dnl Check for AF_INET6 support - unistd.h required for Darwin
-AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
-	AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H
+if test "$with_ipv6" != "no"; then
+	AC_CACHE_CHECK([for IPv6 support], np_cv_sys_ipv6, [
+		AC_TRY_COMPILE(
+			[#ifdef HAVE_UNISTD_H
 			#include <unistd.h>
 			#endif
 			#include <netinet/in.h>
@@ -288,12 +294,16 @@
 			sin6.sin6_family = AF_INET6;
 			sin6.sin6_port = 587;
 			p = &sin6.sin6_addr;],
-			[with_ipv6=yes], 
-			[with_ipv6=no])
-	])
-
-if test x"$with_ipv6" != xno ; then
-	AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
+			[np_cv_sys_ipv6=yes],
+			[np_cv_sys_ipv6=no])
+		])
+	if test "$np_cv_sys_ipv6" = "no" -a "$with_ipv6" != "check"; then
+		AC_MSG_FAILURE([--with-ipv6 was given, but test for IPv6 support failed])
+	fi
+	if test "$np_cv_sys_ipv6" = "yes"; then
+		AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
+	fi
+	with_ipv6="$np_cv_sys_ipv6"
 fi
 
 

Modified: nagiosplug/trunk/plugins/netutils.c
===================================================================
--- nagiosplug/trunk/plugins/netutils.c	2007-09-23 12:29:36 UTC (rev 1793)
+++ nagiosplug/trunk/plugins/netutils.c	2007-09-24 00:30:14 UTC (rev 1794)
@@ -39,7 +39,11 @@
 unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; 
 int econn_refuse_state = STATE_CRITICAL;
 int was_refused = FALSE;
+#if USE_IPV6
 int address_family = AF_UNSPEC;
+#else
+int address_family = AF_INET;
+#endif
 
 /* handles socket timeouts */
 void


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list