Module: monitoring-plugins Branch: master Commit: a1472be88322140cf1f2fc39b9e1b654a86f8155 Author: William <will...@blackhats.net.au> Date: Fri Mar 28 12:40:35 2025 +1000 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a1472be8
Harden check with unspec --- plugins/check_fping.c | 4 ++-- 1 file 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) { /* compose the command */ #ifdef PATH_TO_FPING6 - if (address_family != AF_INET && is_inet6_addr(server)) { + if (address_family == AF_INET6 || (address_family == AF_UNSPEC && is_inet6_addr(server))) { fping_prog = strdup(PATH_TO_FPING6); } else { xasprintf(&option_string, "%s-4 ", option_string); fping_prog = strdup(PATH_TO_FPING); } #else - if (address_family != AF_INET) { + if (address_family == AF_INET6 || (address_family == AF_UNSPEC && is_inet6_addr(server))) { // -4 / -6 must be set explicitly as when a host has dual stack // if we don't specify -4 then fping selects ipv6 which can mess // with some checks.