diff options
Diffstat (limited to 'plugins/check_tcp.c')
| -rw-r--r-- | plugins/check_tcp.c | 16 |
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"; | |||
| 29 | const char *option_summary = "\ | 29 | const char *option_summary = "\ |
| 30 | -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\ | 30 | -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\ |
| 31 | [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\ | 31 | [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\ |
| 32 | [-t to_sec] [-r refuse_state] [-v]\n"; | 32 | [-t to_sec] [-r refuse_state] [-v] [-4] [-6]\n"; |
| 33 | 33 | ||
| 34 | const char *options = "\ | 34 | const char *options = "\ |
| 35 | -H, --hostname=ADDRESS\n\ | 35 | -H, --hostname=ADDRESS\n\ |
| @@ -37,6 +37,10 @@ const char *options = "\ | |||
| 37 | address if possible to bypass DNS lookup).\n\ | 37 | address if possible to bypass DNS lookup).\n\ |
| 38 | -p, --port=INTEGER\n\ | 38 | -p, --port=INTEGER\n\ |
| 39 | Port number\n\ | 39 | Port number\n\ |
| 40 | -4, --use-ipv4\n\ | ||
| 41 | Use IPv4 connection\n\ | ||
| 42 | -6, --use-ipv6\n\ | ||
| 43 | Use IPv6 connection\n\ | ||
| 40 | -s, --send=STRING\n\ | 44 | -s, --send=STRING\n\ |
| 41 | String to send to the server\n\ | 45 | String to send to the server\n\ |
| 42 | -e, --expect=STRING\n\ | 46 | -e, --expect=STRING\n\ |
| @@ -392,6 +396,8 @@ process_arguments (int argc, char **argv) | |||
| 392 | {"quit", required_argument, 0, 'q'}, | 396 | {"quit", required_argument, 0, 'q'}, |
| 393 | {"delay", required_argument, 0, 'd'}, | 397 | {"delay", required_argument, 0, 'd'}, |
| 394 | {"refuse", required_argument, 0, 'r'}, | 398 | {"refuse", required_argument, 0, 'r'}, |
| 399 | {"use-ipv4", no_argument, 0, '4'}, | ||
| 400 | {"use-ipv6", no_argument, 0, '6'}, | ||
| 395 | {"verbose", no_argument, 0, 'v'}, | 401 | {"verbose", no_argument, 0, 'v'}, |
| 396 | {"version", no_argument, 0, 'V'}, | 402 | {"version", no_argument, 0, 'V'}, |
| 397 | {"help", no_argument, 0, 'h'}, | 403 | {"help", no_argument, 0, 'h'}, |
| @@ -419,7 +425,7 @@ process_arguments (int argc, char **argv) | |||
| 419 | } | 425 | } |
| 420 | 426 | ||
| 421 | while (1) { | 427 | while (1) { |
| 422 | c = getopt_long (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:Sr:", | 428 | c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:", |
| 423 | long_options, &option_index); | 429 | long_options, &option_index); |
| 424 | 430 | ||
| 425 | if (c == -1 || c == EOF || c == 1) | 431 | if (c == -1 || c == EOF || c == 1) |
| @@ -439,6 +445,12 @@ process_arguments (int argc, char **argv) | |||
| 439 | case 'v': /* verbose mode */ | 445 | case 'v': /* verbose mode */ |
| 440 | verbose = TRUE; | 446 | verbose = TRUE; |
| 441 | break; | 447 | break; |
| 448 | case '4': | ||
| 449 | address_family = AF_INET; | ||
| 450 | break; | ||
| 451 | case '6': | ||
| 452 | address_family = AF_INET6; | ||
| 453 | break; | ||
| 442 | case 'H': /* hostname */ | 454 | case 'H': /* hostname */ |
| 443 | if (is_host (optarg) == FALSE) | 455 | if (is_host (optarg) == FALSE) |
| 444 | usage2 ("invalid host name or address", optarg); | 456 | usage2 ("invalid host name or address", optarg); |
