File: 20_check_icmp_fix_rtmin

package info (click to toggle)
monitoring-plugins 2.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 11,704 kB
  • sloc: ansic: 76,177; sh: 13,717; perl: 7,655; makefile: 489
file content (29 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From e5f35d40556468fcdebccae847cfc19380952ca0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenz=20K=C3=A4stle?=
 <12514511+RincewindsHat@users.noreply.github.com>
Date: Wed, 27 Nov 2024 15:29:19 +0100
Subject: [PATCH] check_icmp: set rtmin initially

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

--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -64,6 +64,7 @@
 #include <netinet/ip_icmp.h>
 #include <netinet/icmp6.h>
 #include <arpa/inet.h>
+#include <math.h>
 
 
 /** sometimes undefined system macros (quite a few, actually) **/
@@ -1051,7 +1052,7 @@
 		icmp_recv++;
 		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;
 
 		if(debug) {