[monitoring-plugins] check_icmp: set rtmin initially

Sven Nierlein git at monitoring-plugins.org
Thu Nov 28 09:10:12 CET 2024


    Module: monitoring-plugins
    Branch: master
    Commit: 89f79cf2d216fed07de554ef01e230de7e2a5c56
    Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
 Committer: Sven Nierlein <sven at nierlein.org>
      Date: Wed Nov 27 15:29:19 2024 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=89f79cf

check_icmp: set rtmin initially

---

 plugins-root/check_icmp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index e6a0096..dcacedd 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -64,6 +64,7 @@ const char *email = "devel at monitoring-plugins.org";
 #include <netinet/ip_icmp.h>
 #include <netinet/icmp6.h>
 #include <arpa/inet.h>
+#include <math.h>
 
 /** sometimes undefined system macros (quite a few, actually) **/
 #ifndef MAXTTL
@@ -1099,7 +1100,8 @@ static int wait_for_reply(int sock, u_int t) {
 		if (tdiff > (unsigned int)host->rtmax) {
 			host->rtmax = tdiff;
 		}
-		if (tdiff < (unsigned int)host->rtmin) {
+
+		if ((host->rtmin == INFINITY) || (tdiff < (unsigned int)host->rtmin)) {
 			host->rtmin = tdiff;
 		}
 



More information about the Commits mailing list