summaryrefslogtreecommitdiffstats
path: root/plugins/check_fping.c
diff options
context:
space:
mode:
authorWilliam <william@blackhats.net.au>2025-03-28 12:40:35 +1000
committerWilliam <william@blackhats.net.au>2025-05-07 13:15:51 +1000
commita1472be88322140cf1f2fc39b9e1b654a86f8155 (patch)
tree3be8ecca52290270c9325157abe8c75bd840035a /plugins/check_fping.c
parent4acba2b3ecef7c1482b3cd25e35773947d80e2c6 (diff)
downloadmonitoring-plugins-a1472be88322140cf1f2fc39b9e1b654a86f8155.tar.gz
Harden check with unspec
Diffstat (limited to 'plugins/check_fping.c')
-rw-r--r--plugins/check_fping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 1c2b7689..cf9c2d1c 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -83,14 +83,14 @@ int main(int argc, char **argv) {
83 83
84 /* compose the command */ 84 /* compose the command */
85#ifdef PATH_TO_FPING6 85#ifdef PATH_TO_FPING6
86 if (address_family != AF_INET && is_inet6_addr(server)) { 86 if (address_family == AF_INET6 || (address_family == AF_UNSPEC && is_inet6_addr(server))) {
87 fping_prog = strdup(PATH_TO_FPING6); 87 fping_prog = strdup(PATH_TO_FPING6);
88 } else { 88 } else {
89 xasprintf(&option_string, "%s-4 ", option_string); 89 xasprintf(&option_string, "%s-4 ", option_string);
90 fping_prog = strdup(PATH_TO_FPING); 90 fping_prog = strdup(PATH_TO_FPING);
91 } 91 }
92#else 92#else
93 if (address_family != AF_INET) { 93 if (address_family == AF_INET6 || (address_family == AF_UNSPEC && is_inet6_addr(server))) {
94 // -4 / -6 must be set explicitly as when a host has dual stack 94 // -4 / -6 must be set explicitly as when a host has dual stack
95 // if we don't specify -4 then fping selects ipv6 which can mess 95 // if we don't specify -4 then fping selects ipv6 which can mess
96 // with some checks. 96 // with some checks.