From deadc98264563366726f3698bc57dc1eda13ae75 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 9 Nov 2006 11:44:16 +0000 Subject: Reduced DNS lookups in check_ping and netutils.c in IPv6 configurations (Pawel Malachowski) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1535 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/CHANGES b/CHANGES index 7b1bf9c..74c5a66 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,14 @@ This file documents the major additions and syntax changes between releases. +?? + Reduced number of DNS lookups in check_ping and netutils.c for IPv6 configurations + +1.4.6 + Fixed compile problems with *BSD re: alloca.h + +1.4.5 + Fixed bug in perl's is_hostname routine + 1.4.4 New C based check_ntp. The perl version is now deprecated. New check_apt plugin diff --git a/THANKS.in b/THANKS.in index 591ae54..9d880e4 100644 --- a/THANKS.in +++ b/THANKS.in @@ -200,3 +200,4 @@ Robby Giffin Henning Schmiedehausen Markus Baertschi Florian Gleixner +Pawel Malachowski diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 750b055..9652ab7 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -109,7 +109,7 @@ main (int argc, char **argv) for (i = 0 ; i < n_addresses ; i++) { #ifdef PING6_COMMAND - if (is_inet6_addr(addresses[i]) && address_family != AF_INET) + if (address_family != AF_INET && is_inet6_addr(addresses[i])) rawcmd = strdup(PING6_COMMAND); else rawcmd = strdup(PING_COMMAND); diff --git a/plugins/netutils.c b/plugins/netutils.c index a3a241d..9294f3a 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c @@ -324,14 +324,12 @@ int is_addr (const char *address) { #ifdef USE_IPV6 - if (is_inet_addr (address) && address_family != AF_INET6) + if (address_family == AF_INET && is_inet_addr (address)) + return TRUE; + else if (address_family == AF_INET6 && is_inet6_addr (address)) + return TRUE; #else if (is_inet_addr (address)) -#endif - return (TRUE); - -#ifdef USE_IPV6 - if (is_inet6_addr (address) && address_family != AF_INET) return (TRUE); #endif -- cgit v0.10-9-g596f