summaryrefslogtreecommitdiffstats
path: root/plugins/check_fping.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_fping.c')
-rw-r--r--plugins/check_fping.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 49235e28..c1d03ece 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Description: 8 * Description:
9 * 9 *
10 * This file contains the check_disk plugin 10 * This file contains the check_fping plugin
11 * 11 *
12 * This plugin will use the fping command to ping the specified host for a 12 * This plugin will use the fping command to ping the specified host for a
13 * fast check 13 * fast check
@@ -60,6 +60,8 @@ static int packet_count = PACKET_COUNT;
60static int target_timeout = 0; 60static int target_timeout = 0;
61static int packet_interval = 0; 61static int packet_interval = 0;
62static bool verbose = false; 62static bool verbose = false;
63static bool dontfrag = false;
64static bool randomize_packet_data = false;
63static int cpl; 65static int cpl;
64static int wpl; 66static int wpl;
65static double crta; 67static double crta;
@@ -103,6 +105,11 @@ int main(int argc, char **argv) {
103 xasprintf(&option_string, "%s-S %s ", option_string, sourceip); 105 xasprintf(&option_string, "%s-S %s ", option_string, sourceip);
104 if (sourceif) 106 if (sourceif)
105 xasprintf(&option_string, "%s-I %s ", option_string, sourceif); 107 xasprintf(&option_string, "%s-I %s ", option_string, sourceif);
108 if (dontfrag)
109 xasprintf(&option_string, "%s-M ", option_string);
110 if (randomize_packet_data)
111 xasprintf(&option_string, "%s-R ", option_string);
112
106 113
107#ifdef PATH_TO_FPING6 114#ifdef PATH_TO_FPING6
108 if (address_family != AF_INET && is_inet6_addr(server)) 115 if (address_family != AF_INET && is_inet6_addr(server))
@@ -279,6 +286,8 @@ int process_arguments(int argc, char **argv) {
279 {"help", no_argument, 0, 'h'}, 286 {"help", no_argument, 0, 'h'},
280 {"use-ipv4", no_argument, 0, '4'}, 287 {"use-ipv4", no_argument, 0, '4'},
281 {"use-ipv6", no_argument, 0, '6'}, 288 {"use-ipv6", no_argument, 0, '6'},
289 {"dontfrag", no_argument, 0, 'M'},
290 {"random", no_argument, 0, 'R'},
282 {0, 0, 0, 0}}; 291 {0, 0, 0, 0}};
283 292
284 rv[PL] = NULL; 293 rv[PL] = NULL;
@@ -295,7 +304,7 @@ int process_arguments(int argc, char **argv) {
295 } 304 }
296 305
297 while (1) { 306 while (1) {
298 c = getopt_long(argc, argv, "+hVvaH:S:c:w:b:n:T:i:I:46", longopts, &option); 307 c = getopt_long(argc, argv, "+hVvaH:S:c:w:b:n:T:i:I:M:R:46", longopts, &option);
299 308
300 if (c == -1 || c == EOF || c == 1) 309 if (c == -1 || c == EOF || c == 1)
301 break; 310 break;
@@ -390,6 +399,12 @@ int process_arguments(int argc, char **argv) {
390 else 399 else
391 usage(_("Interval must be a positive integer")); 400 usage(_("Interval must be a positive integer"));
392 break; 401 break;
402 case 'R':
403 randomize_packet_data = true;
404 break;
405 case 'M':
406 dontfrag = true;
407 break;
393 } 408 }
394 } 409 }
395 410
@@ -470,6 +485,10 @@ void print_help(void) {
470 printf(" %s\n", _("name or IP Address of sourceip")); 485 printf(" %s\n", _("name or IP Address of sourceip"));
471 printf(" %s\n", "-I, --sourceif=IF"); 486 printf(" %s\n", "-I, --sourceif=IF");
472 printf(" %s\n", _("source interface name")); 487 printf(" %s\n", _("source interface name"));
488 printf(" %s\n", "-M, --dontfrag");
489 printf(" %s\n", _("set the Don't Fragment flag"));
490 printf(" %s\n", "-R, --random");
491 printf(" %s\n", _("random packet data (to foil link data compression)"));
473 printf(UT_VERBOSE); 492 printf(UT_VERBOSE);
474 printf("\n"); 493 printf("\n");
475 printf(" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)")); 494 printf(" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));