summaryrefslogtreecommitdiffstats
path: root/plugins/check_fping.c
diff options
context:
space:
mode:
authorWilliam <william@blackhats.net.au>2024-11-06 04:00:23 (GMT)
committerWilliam <william@blackhats.net.au>2024-11-06 09:26:46 (GMT)
commit88d991773b6d8ac416ad2931ea8debc949555c7a (patch)
tree0a0299dd527d6db5a0881a3c06e7306ddedf8a66 /plugins/check_fping.c
parent94150ae347beb25ac369d5773834ceef7f3736d3 (diff)
downloadmonitoring-plugins-88d991773b6d8ac416ad2931ea8debc949555c7a.tar.gz
Add dontfrag/random for fpingrefs/pull/2041/head
Support the dont fragment and randomise packet data options for check_fping
Diffstat (limited to 'plugins/check_fping.c')
-rw-r--r--plugins/check_fping.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 49235e2..67fa236 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -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;
@@ -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)"));