summaryrefslogtreecommitdiffstats
path: root/plugins/netutils.c
diff options
context:
space:
mode:
authorJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-06-29 19:17:27 +0000
committerJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-06-29 19:17:27 +0000
commit825a7322b131a16819b0cacccc186b86fffc57eb (patch)
tree94311e40058eb5e25321575bd9dd9f9b0c863952 /plugins/netutils.c
parentd77d183ddb8bdff5069ba5fa008406087162d117 (diff)
downloadmonitoring-plugins-825a7322b131a16819b0cacccc186b86fffc57eb.tar.gz
check_ping is now coded with -4 & -6 options to call PING or PING6 command
netutils modified to verify hosts based on address_family setting when used with -4 or -6 options. is_inet_addr() will not be tested if -6 is used and is_inet6_addr() will not be tested if -4 is used. Also the is_hostname() will use the address_family value to resolve hostnames only if IPv6 support is available otherwise defaults to AF_INET. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@569 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/netutils.c')
-rw-r--r--plugins/netutils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c
index dc679e2a..60410c64 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -326,11 +326,11 @@ is_host (char *address)
326int 326int
327is_addr (char *address) 327is_addr (char *address)
328{ 328{
329 if (is_inet_addr (address)) 329 if (is_inet_addr (address) && address_family != AF_INET6)
330 return (TRUE); 330 return (TRUE);
331 331
332#ifdef USE_IPV6 332#ifdef USE_IPV6
333 if (is_inet6_addr (address)) 333 if (is_inet6_addr (address) && address_family != AF_INET)
334 return (TRUE); 334 return (TRUE);
335#endif 335#endif
336 336
@@ -374,7 +374,7 @@ int
374is_hostname (char *s1) 374is_hostname (char *s1)
375{ 375{
376#ifdef USE_IPV6 376#ifdef USE_IPV6
377 return resolve_host_or_addr (s1, AF_UNSPEC); 377 return resolve_host_or_addr (s1, address_family);
378#else 378#else
379 return resolve_host_or_addr (s1, AF_INET); 379 return resolve_host_or_addr (s1, AF_INET);
380#endif 380#endif