From 8c623b1a432524950050ef6f2d273a87e013dacf Mon Sep 17 00:00:00 2001 From: Alexander Wittig Date: Mon, 16 Dec 2013 13:15:31 +0100 Subject: check_dig: Fix to work with dig and drill tool FreeBSD starting with version 10 is shipped with ldns instead of bind as resolver. Consequently the dig tool in base is replaced by drill. While dig can still be installed as a third party application, it would be nice to make do with the tools available in the system already. This patch rearranges the command line used to invoke dig slightly so that it can be used with both dig and drill (tested with dig 9.8.3-P1 and 9.9.4 as well as drill 1.6.16). It would be really neat if the configure script could be changed to automatically pick up drill when dig is not available (or the other way around), but my autotools-foo is not good enough for that. This part of the patch is an extended version of the locally maintained patch currently deployed in the FreeBSD ports tree by Dmitry Sivachenko. --- plugins/check_dig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_dig.c b/plugins/check_dig.c index d9481f2d..8d996b08 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -94,8 +94,8 @@ main (int argc, char **argv) timeout_interval_dig = timeout_interval / number_tries + number_tries; /* get the command to run */ - xasprintf (&command_line, "%s @%s -p %d %s -t %s %s %s +tries=%d +time=%d", - PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args, query_transport, number_tries, timeout_interval_dig); + xasprintf (&command_line, "%s %s %s -p %d @%s %s %s +tries=%d +time=%d", + PATH_TO_DIG, dig_args, query_transport, server_port, dns_server, query_address, record_type, number_tries, timeout_interval_dig); alarm (timeout_interval); gettimeofday (&tv, NULL); -- cgit v1.2.3-74-g34f1 From 8d50765653f1cefa551888e6d1f1ff91151f91fa Mon Sep 17 00:00:00 2001 From: Alexander Wittig Date: Mon, 16 Dec 2013 13:28:21 +0100 Subject: check_dig: takes into account the -4 and -6 switch Fix automatic DNS server name detection to honor -4 and -6 switches (default to 127.0.0.1 or ::1 respectively, i.e. if -6 is given ::1 is used instead of 127.0.0.1) --- plugins/check_dig.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 8d996b08..d899b119 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -296,7 +296,10 @@ process_arguments (int argc, char **argv) dns_server = argv[c]; } else { - dns_server = strdup ("127.0.0.1"); + if (strcmp(query_transport,"-6") == 0) + dns_server = strdup("::1"); + else + dns_server = strdup ("127.0.0.1"); } } -- cgit v1.2.3-74-g34f1 From f28dc3ba200b0e7a59f9a4157a3d83f73fa1071b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 30 Jul 2014 15:19:48 +0200 Subject: Adding Alexander Wittig to THANKS.in --- Closes #1218 Closes #1281 --- THANKS.in | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS.in b/THANKS.in index b6dc2941..ebd13e17 100644 --- a/THANKS.in +++ b/THANKS.in @@ -326,3 +326,4 @@ Mikael Falkvidd Patric Wust Julius Kriukas Patrick McAndrew +Alexander Wittig -- cgit v1.2.3-74-g34f1