aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_tcp.c
diff options
context:
space:
mode:
authorGravatar Jeremy T. Bouse <undrgrid@users.sourceforge.net> 2003-06-29 06:36:55 +0000
committerGravatar Jeremy T. Bouse <undrgrid@users.sourceforge.net> 2003-06-29 06:36:55 +0000
commitd77d183ddb8bdff5069ba5fa008406087162d117 (patch)
tree35ece18bb2080b168605c5533e4ff6b1574f9f88 /plugins/check_tcp.c
parentcb448eb1d57259641e10494e8d74d885e44c215d (diff)
downloadmonitoring-plugins-d77d183ddb8bdff5069ba5fa008406087162d117.tar.gz
Added address_family extern int variable to netutils to allow for -4 & -6
options for explicit connection protocol Added support for -4 & -6 options to check_ssh and check_tcp for testing git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@568 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r--plugins/check_tcp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index f4fe5f40..0f19c01e 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -29,7 +29,7 @@ This plugin tests %s connections with the specified host.\n";
const char *option_summary = "\
-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
- [-t to_sec] [-r refuse_state] [-v]\n";
+ [-t to_sec] [-r refuse_state] [-v] [-4] [-6]\n";
const char *options = "\
-H, --hostname=ADDRESS\n\
@@ -37,6 +37,10 @@ const char *options = "\
address if possible to bypass DNS lookup).\n\
-p, --port=INTEGER\n\
Port number\n\
+ -4, --use-ipv4\n\
+ Use IPv4 connection\n\
+ -6, --use-ipv6\n\
+ Use IPv6 connection\n\
-s, --send=STRING\n\
String to send to the server\n\
-e, --expect=STRING\n\
@@ -392,6 +396,8 @@ process_arguments (int argc, char **argv)
{"quit", required_argument, 0, 'q'},
{"delay", required_argument, 0, 'd'},
{"refuse", required_argument, 0, 'r'},
+ {"use-ipv4", no_argument, 0, '4'},
+ {"use-ipv6", no_argument, 0, '6'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
@@ -419,7 +425,7 @@ process_arguments (int argc, char **argv)
}
while (1) {
- c = getopt_long (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:Sr:",
+ c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:",
long_options, &option_index);
if (c == -1 || c == EOF || c == 1)
@@ -439,6 +445,12 @@ process_arguments (int argc, char **argv)
case 'v': /* verbose mode */
verbose = TRUE;
break;
+ case '4':
+ address_family = AF_INET;
+ break;
+ case '6':
+ address_family = AF_INET6;
+ break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
usage2 ("invalid host name or address", optarg);