diff options
author | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-05-07 18:01:32 +0000 |
---|---|---|
committer | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-05-07 18:01:32 +0000 |
commit | 6882b543648b994a1707a96a9116ae52fe72b57a (patch) | |
tree | 1606ebbfd7f7f5caca49f97d52b88d55150426ca /plugins | |
parent | 9d7f91d6dcb42f75b4c44e30673fdc2e579704e9 (diff) | |
download | monitoring-plugins-6882b543648b994a1707a96a9116ae52fe72b57a.tar.gz |
Modified check_ping to handle IPv6 as well as IPv4 ICMP checks using the
PING6_COMMAND determined during the configure script execution. As
USE_IPV6 may be defined and PING6_COMMAND is not defined if there is not
IPv6 TCP stack available when configure is run I condition it off
PING6_COMMAND existing to remove build errors for being undefined.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@500 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ping.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 2526a74f..54402ae3 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -104,11 +104,25 @@ main (int argc, char **argv) | |||
104 | for (i = 0 ; i < n_addresses ; i++) { | 104 | for (i = 0 ; i < n_addresses ; i++) { |
105 | 105 | ||
106 | /* does the host address of number of packets argument come first? */ | 106 | /* does the host address of number of packets argument come first? */ |
107 | #ifdef PING_PACKETS_FIRST | 107 | #ifdef PING6_COMMAND |
108 | # ifdef PING_PACKETS_FIRST | ||
109 | if (is_inet6_addr(addresses[i])) | ||
110 | asprintf (&command_line, PING6_COMMAND, max_packets, addresses[i]); | ||
111 | else | ||
112 | asprintf (&command_line, PING_COMMAND, max_packets, addresses[i]); | ||
113 | # else | ||
114 | if (is_inet6_addr(addresses[i])) | ||
115 | asprintf (&command_line, PING6_COMMAND, addresses[i], max_packets); | ||
116 | else | ||
117 | asprintf (&command_line, PING_COMMAND, addresses[i], max_packets); | ||
118 | # endif | ||
119 | #else /* USE_IPV6 */ | ||
120 | # ifdef PING_PACKETS_FIRST | ||
108 | asprintf (&command_line, PING_COMMAND, max_packets, addresses[i]); | 121 | asprintf (&command_line, PING_COMMAND, max_packets, addresses[i]); |
109 | #else | 122 | # else |
110 | asprintf (&command_line, PING_COMMAND, addresses[i], max_packets); | 123 | asprintf (&command_line, PING_COMMAND, addresses[i], max_packets); |
111 | #endif | 124 | # endif |
125 | #endif /* USE_IPV6 */ | ||
112 | 126 | ||
113 | if (verbose) | 127 | if (verbose) |
114 | printf ("%s ==> ", command_line); | 128 | printf ("%s ==> ", command_line); |