diff options
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | plugins/check_fping.c | 42 |
2 files changed, 0 insertions, 49 deletions
diff --git a/configure.ac b/configure.ac index fdc9b699..bd3de196 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1524,17 +1524,10 @@ AC_PATH_PROG(PATH_TO_FPING6,fping6) | |||
1524 | AC_ARG_WITH(fping_command, | 1524 | AC_ARG_WITH(fping_command, |
1525 | ACX_HELP_STRING([--with-fping-command=PATH], | 1525 | ACX_HELP_STRING([--with-fping-command=PATH], |
1526 | [Path to fping command]), PATH_TO_FPING=$withval) | 1526 | [Path to fping command]), PATH_TO_FPING=$withval) |
1527 | AC_ARG_WITH(fping6_command, | ||
1528 | ACX_HELP_STRING([--with-fping6-command=PATH], | ||
1529 | [Path to fping6 command]), PATH_TO_FPING6=$withval) | ||
1530 | |||
1531 | if test -n "$PATH_TO_FPING" | 1527 | if test -n "$PATH_TO_FPING" |
1532 | then | 1528 | then |
1533 | AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping]) | 1529 | AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping]) |
1534 | EXTRAS="$EXTRAS check_fping\$(EXEEXT)" | 1530 | EXTRAS="$EXTRAS check_fping\$(EXEEXT)" |
1535 | if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then | ||
1536 | AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6]) | ||
1537 | fi | ||
1538 | else | 1531 | else |
1539 | AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin]) | 1532 | AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin]) |
1540 | fi | 1533 | fi |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 9dadcec7..e05056b2 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
@@ -82,28 +82,8 @@ int main(int argc, char **argv) { | |||
82 | char *fping_prog = NULL; | 82 | char *fping_prog = NULL; |
83 | 83 | ||
84 | /* First determine if the target is dualstack or ipv6 only. */ | 84 | /* First determine if the target is dualstack or ipv6 only. */ |
85 | #ifdef USE_IPV6 | ||
86 | bool server_is_inet6_addr = is_inet6_addr(server); | 85 | bool server_is_inet6_addr = is_inet6_addr(server); |
87 | #else | ||
88 | bool server_is_inet6_addr = false; | ||
89 | #endif | ||
90 | 86 | ||
91 | /* PATH_TO_FPING6 implies USE_IPV6 */ | ||
92 | #ifdef PATH_TO_FPING6 | ||
93 | /* | ||
94 | * If the user requested -6 OR the user made no assertion and the address is v6 or dualstack | ||
95 | * -> we use ipv6 | ||
96 | * If the user requested -4 OR the user made no assertion and the address is v4 ONLY | ||
97 | * -> we use ipv4 | ||
98 | */ | ||
99 | if (address_family == AF_INET6 || (address_family == AF_UNSPEC && server_is_inet6_addr)) { | ||
100 | fping_prog = strdup(PATH_TO_FPING6); | ||
101 | } else { | ||
102 | xasprintf(&option_string, "%s-4 ", option_string); | ||
103 | fping_prog = strdup(PATH_TO_FPING); | ||
104 | } | ||
105 | #else | ||
106 | #ifdef USE_IPV6 | ||
107 | /* | 87 | /* |
108 | * If the user requested -6 OR the user made no assertion and the address is v6 or dualstack | 88 | * If the user requested -6 OR the user made no assertion and the address is v6 or dualstack |
109 | * -> we use ipv6 | 89 | * -> we use ipv6 |
@@ -115,25 +95,7 @@ int main(int argc, char **argv) { | |||
115 | } else { | 95 | } else { |
116 | xasprintf(&option_string, "%s-4 ", option_string); | 96 | xasprintf(&option_string, "%s-4 ", option_string); |
117 | } | 97 | } |
118 | #else | ||
119 | /* | ||
120 | * If the user requested -6 | ||
121 | * -> warn that v6 is not available | ||
122 | * -> we use ipv4 | ||
123 | */ | ||
124 | if (address_family == AF_INET6) { | ||
125 | usage4(_("IPv6 support not available")); | ||
126 | } | ||
127 | /* | ||
128 | * Note here we still have to call with -4, else in the case of a dual stacked target | ||
129 | * we could potentially silently use ipv6 despite having just warned that it is not available | ||
130 | */ | ||
131 | xasprintf(&option_string, "%s-4 ", option_string); | ||
132 | /* end USE_IPV6 */ | ||
133 | #endif | ||
134 | fping_prog = strdup(PATH_TO_FPING); | 98 | fping_prog = strdup(PATH_TO_FPING); |
135 | /* end PATH_TO_FPING6 */ | ||
136 | #endif | ||
137 | 99 | ||
138 | /* compose the command */ | 100 | /* compose the command */ |
139 | if (config.target_timeout) { | 101 | if (config.target_timeout) { |
@@ -385,11 +347,7 @@ check_fping_config_wrapper process_arguments(int argc, char **argv) { | |||
385 | address_family = AF_INET; | 347 | address_family = AF_INET; |
386 | break; | 348 | break; |
387 | case '6': /* IPv6 only */ | 349 | case '6': /* IPv6 only */ |
388 | #ifdef USE_IPV6 | ||
389 | address_family = AF_INET6; | 350 | address_family = AF_INET6; |
390 | #else | ||
391 | usage(_("IPv6 support not available\n")); | ||
392 | #endif | ||
393 | break; | 351 | break; |
394 | case 'c': | 352 | case 'c': |
395 | get_threshold(optarg, rv); | 353 | get_threshold(optarg, rv); |