summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Hansen <jhansen@op5.com>2018-12-10 13:49:13 +0000
committerJacob Hansen <jhansen@op5.com>2018-12-10 14:39:13 +0000
commitca6efcd02b203e9e07b869af050c1b9849e04608 (patch)
tree57785b1057f4b0e7a8800ed41d73e0ddc4c0e171
parent7a660b3f018e0903e098cbd2e766a9af18f6723f (diff)
downloadmonitoring-plugins-ca6efcd.tar.gz
check_icmp: emit error if multiple protocol version
As we do not support checking both IPv4 and IPv6 hosts in one execution we emit an error if multiple protocol versions are defined in the cmd line args. Signed-off-by: Jacob Hansen <jhansen@op5.com>
-rw-r--r--plugins-root/check_icmp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 6a883a82..98891f02 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -467,10 +467,14 @@ main(int argc, char **argv)
467 unsigned short size; 467 unsigned short size;
468 switch(arg) { 468 switch(arg) {
469 case '4': 469 case '4':
470 if (address_family != -1)
471 crash("Multiple protocol versions not supported");
470 address_family = AF_INET; 472 address_family = AF_INET;
471 break; 473 break;
472 case '6': 474 case '6':
473#ifdef USE_IPV6 475#ifdef USE_IPV6
476 if (address_family != -1)
477 crash("Multiple protocol versions not supported");
474 address_family = AF_INET6; 478 address_family = AF_INET6;
475#else 479#else
476 usage (_("IPv6 support not available\n")); 480 usage (_("IPv6 support not available\n"));