[monitoring-plugins] check_icmp: remove unnecessary variable

Lorenz Kästle git at monitoring-plugins.org
Mon Jun 23 12:10:11 CEST 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 771ccfa52691e591be3736b6d03f36e69d82e464
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Mon Jun 23 11:41:24 2025 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=771ccfa5

check_icmp: remove unnecessary variable

---

 plugins-root/check_icmp.c                      | 3 +--
 plugins-root/check_icmp.d/check_icmp_helpers.c | 1 -
 plugins-root/check_icmp.d/config.h             | 1 -
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 3edfffa2..be686ee3 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -407,7 +407,6 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) {
 				if ((unsigned long)size >= (sizeof(struct icmp) + sizeof(struct icmp_ping_data)) &&
 					size < MAX_PING_DATA) {
 					result.config.icmp_data_size = (unsigned short)size;
-					result.config.icmp_pkt_size = (unsigned short)(size + ICMP_MINLEN);
 				} else {
 					usage_va("ICMP data length must be between: %lu and %lu",
 							 sizeof(struct icmp) + sizeof(struct icmp_ping_data),
@@ -945,7 +944,7 @@ int main(int argc, char **argv) {
 		printf("crit = {%ld, %u%%}, warn = {%ld, %u%%}\n", config.crit.rta, config.crit.pl,
 			   config.warn.rta, config.warn.pl);
 		printf("target_interval: %ld\n", config.target_interval);
-		printf("icmp_pkt_size: %u  timeout: %u\n", config.icmp_pkt_size, timeout);
+		printf("icmp_pkt_size: %u  timeout: %u\n", config.icmp_data_size + ICMP_MINLEN, timeout);
 	}
 
 	if (config.min_hosts_alive < -1) {
diff --git a/plugins-root/check_icmp.d/check_icmp_helpers.c b/plugins-root/check_icmp.d/check_icmp_helpers.c
index 0be0f2dc..d56fbd8b 100644
--- a/plugins-root/check_icmp.d/check_icmp_helpers.c
+++ b/plugins-root/check_icmp.d/check_icmp_helpers.c
@@ -34,7 +34,6 @@ check_icmp_config check_icmp_config_init() {
 
 		.ttl = DEFAULT_TTL,
 		.icmp_data_size = DEFAULT_PING_DATA_SIZE,
-		.icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN,
 		.target_interval = 0,
 		.number_of_packets = DEFAULT_NUMBER_OF_PACKETS,
 
diff --git a/plugins-root/check_icmp.d/config.h b/plugins-root/check_icmp.d/config.h
index 1568d6c3..ab578ba5 100644
--- a/plugins-root/check_icmp.d/config.h
+++ b/plugins-root/check_icmp.d/config.h
@@ -60,7 +60,6 @@ typedef struct {
 
 	unsigned long ttl;
 	unsigned short icmp_data_size;
-	unsigned short icmp_pkt_size;
 	time_t target_interval;
 	unsigned short number_of_packets;
 



More information about the Commits mailing list