[Nagiosplug-checkins] CVS: nagiosplug/plugins check_ping.c,1.15,1.16 netutils.c,1.9,1.10
Jeremy T. Bouse
undrgrid at users.sourceforge.net
Sun Jun 29 12:18:05 CEST 2003
- Previous message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_ssh.c,1.7,1.8 check_tcp.c,1.23,1.24 netutils.c,1.8,1.9 netutils.h,1.4,1.5
- Next message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_ping.c,1.16,1.17 check_tcp.c,1.24,1.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv10101/plugins
Modified Files:
check_ping.c netutils.c
Log Message:
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.
Index: check_ping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** check_ping.c 7 May 2003 18:01:32 -0000 1.15
--- check_ping.c 29 Jun 2003 19:17:27 -0000 1.16
***************
*** 20,28 ****
#define OPTIONS "\
-H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
! [-p packets] [-t timeout] [-L]\n"
#define LONGOPTIONS "\
-H, --hostname=HOST\n\
host to ping\n\
-w, --warning=THRESHOLD\n\
warning threshold pair\n\
--- 20,32 ----
#define OPTIONS "\
-H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
! [-p packets] [-t timeout] [-L] [-4] [-6]\n"
#define LONGOPTIONS "\
-H, --hostname=HOST\n\
host to ping\n\
+ -4, --use-ipv4\n\
+ Use IPv4 ICMP PING\n\
+ -6, --use-ipv6\n\
+ Use IPv6 ICMP PING\n\
-w, --warning=THRESHOLD\n\
warning threshold pair\n\
***************
*** 47,50 ****
--- 51,55 ----
#include "config.h"
#include "common.h"
+ #include "netutils.h"
#include "popen.h"
#include "utils.h"
***************
*** 107,116 ****
#ifdef PING6_COMMAND
# ifdef PING_PACKETS_FIRST
! if (is_inet6_addr(addresses[i]))
asprintf (&command_line, PING6_COMMAND, max_packets, addresses[i]);
else
asprintf (&command_line, PING_COMMAND, max_packets, addresses[i]);
# else
! if (is_inet6_addr(addresses[i]))
asprintf (&command_line, PING6_COMMAND, addresses[i], max_packets);
else
--- 112,121 ----
#ifdef PING6_COMMAND
# ifdef PING_PACKETS_FIRST
! if (is_inet6_addr(addresses[i]) && address_family != AF_INET)
asprintf (&command_line, PING6_COMMAND, max_packets, addresses[i]);
else
asprintf (&command_line, PING_COMMAND, max_packets, addresses[i]);
# else
! if (is_inet6_addr(addresses[i]) && address_family != AF_INET)
asprintf (&command_line, PING6_COMMAND, addresses[i], max_packets);
else
***************
*** 183,186 ****
--- 188,193 ----
{"nohtml", no_argument, 0, 'n'},
{"link", no_argument, 0, 'L'},
+ {"use-ipv4", no_argument, 0, '4'},
+ {"use-ipv6", no_argument, 0, '6'},
{0, 0, 0, 0}
};
***************
*** 197,201 ****
while (1) {
! c = getopt_long (argc, argv, "VvhnLt:c:w:H:p:", long_options, &option_index);
if (c == -1 || c == EOF)
--- 204,208 ----
while (1) {
! c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", long_options, &option_index);
if (c == -1 || c == EOF)
***************
*** 216,219 ****
--- 223,232 ----
case 'v': /* verbose mode */
verbose = TRUE;
+ break;
+ case '4': /* IPv4 only */
+ address_family = AF_INET;
+ break;
+ case '6': /* IPv6 only */
+ address_family = AF_INET6;
break;
case 'H': /* hostname */
Index: netutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** netutils.c 29 Jun 2003 06:36:55 -0000 1.9
--- netutils.c 29 Jun 2003 19:17:27 -0000 1.10
***************
*** 327,335 ****
is_addr (char *address)
{
! if (is_inet_addr (address))
return (TRUE);
#ifdef USE_IPV6
! if (is_inet6_addr (address))
return (TRUE);
#endif
--- 327,335 ----
is_addr (char *address)
{
! if (is_inet_addr (address) && address_family != AF_INET6)
return (TRUE);
#ifdef USE_IPV6
! if (is_inet6_addr (address) && address_family != AF_INET)
return (TRUE);
#endif
***************
*** 375,379 ****
{
#ifdef USE_IPV6
! return resolve_host_or_addr (s1, AF_UNSPEC);
#else
return resolve_host_or_addr (s1, AF_INET);
--- 375,379 ----
{
#ifdef USE_IPV6
! return resolve_host_or_addr (s1, address_family);
#else
return resolve_host_or_addr (s1, AF_INET);
- Previous message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_ssh.c,1.7,1.8 check_tcp.c,1.23,1.24 netutils.c,1.8,1.9 netutils.h,1.4,1.5
- Next message: [Nagiosplug-checkins] CVS: nagiosplug/plugins check_ping.c,1.16,1.17 check_tcp.c,1.24,1.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commits
mailing list