[monitoring-plugins] check_icmp: fix positional host arguments (#2355)

GitHub git at monitoring-plugins.org
Tue Sep 29 14:50:14 CEST 2026


    Module: monitoring-plugins
    Branch: master
    Commit: 16044da51b933c344f30cc3837e5143ae594f1db
    Author: Carlos <5107748+Devstellar at users.noreply.github.com>
 Committer: GitHub <noreply at github.com>
      Date: Tue Sep 29 14:47:17 2026 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=16044da5

check_icmp: fix positional host arguments (#2355)

* check_icmp: fix positional host arguments

---------

Co-authored-by: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>

---

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

diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index af65bc41..e497572b 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -572,7 +572,29 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) {
 
 	argv = &argv[optind];
 	while (*argv) {
-		add_target(*argv, result.config.mode, enforced_ai_family);
+		add_host_wrapper host_add_result = add_host(*argv, result.config.mode, enforced_ai_family);
+
+		if (host_add_result.error_code == OK) {
+			result.config.hosts[host_counter] = host_add_result.host;
+			host_counter++;
+
+			if (result.config.targets != NULL) {
+				result.config.number_of_targets += ping_target_list_append(
+					result.config.targets, host_add_result.host.target_list);
+			} else {
+				result.config.targets = host_add_result.host.target_list;
+				result.config.number_of_targets += host_add_result.host.number_of_targets;
+			}
+
+			if (host_add_result.has_v4) {
+				result.config.need_v4 = true;
+			}
+			if (host_add_result.has_v6) {
+				result.config.need_v6 = true;
+			}
+		} else {
+			crash("Failed to add host, unable to parse it correctly");
+		}
 		argv++;
 	}
 



More information about the Commits mailing list