summaryrefslogtreecommitdiffstats
path: root/plugins/check_dig.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_dig.c')
-rw-r--r--plugins/check_dig.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 893e0a1..c113d87 100644
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
@@ -54,6 +54,7 @@ char *record_type = "A";
54char *expected_address = NULL; 54char *expected_address = NULL;
55char *dns_server = NULL; 55char *dns_server = NULL;
56char *dig_args = ""; 56char *dig_args = "";
57char *query_transport = "";
57int verbose = FALSE; 58int verbose = FALSE;
58int server_port = DEFAULT_PORT; 59int server_port = DEFAULT_PORT;
59double warning_interval = UNDEFINED; 60double warning_interval = UNDEFINED;
@@ -77,7 +78,7 @@ main (int argc, char **argv)
77 textdomain (PACKAGE); 78 textdomain (PACKAGE);
78 79
79 /* Set signal handling and alarm */ 80 /* Set signal handling and alarm */
80 if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) 81 if (signal (SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR)
81 usage_va(_("Cannot catch SIGALRM")); 82 usage_va(_("Cannot catch SIGALRM"));
82 83
83 /* Parse extra opts if any */ 84 /* Parse extra opts if any */
@@ -87,8 +88,8 @@ main (int argc, char **argv)
87 usage_va(_("Could not parse arguments")); 88 usage_va(_("Could not parse arguments"));
88 89
89 /* get the command to run */ 90 /* get the command to run */
90 xasprintf (&command_line, "%s @%s -p %d %s -t %s %s", 91 xasprintf (&command_line, "%s @%s -p %d %s -t %s %s %s",
91 PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args); 92 PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args, query_transport);
92 93
93 alarm (timeout_interval); 94 alarm (timeout_interval);
94 gettimeofday (&tv, NULL); 95 gettimeofday (&tv, NULL);
@@ -199,6 +200,8 @@ process_arguments (int argc, char **argv)
199 {"record_type", required_argument, 0, 'T'}, 200 {"record_type", required_argument, 0, 'T'},
200 {"expected_address", required_argument, 0, 'a'}, 201 {"expected_address", required_argument, 0, 'a'},
201 {"port", required_argument, 0, 'p'}, 202 {"port", required_argument, 0, 'p'},
203 {"use-ipv4", no_argument, 0, '4'},
204 {"use-ipv6", no_argument, 0, '6'},
202 {0, 0, 0, 0} 205 {0, 0, 0, 0}
203 }; 206 };
204 207
@@ -206,7 +209,7 @@ process_arguments (int argc, char **argv)
206 return ERROR; 209 return ERROR;
207 210
208 while (1) { 211 while (1) {
209 c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:", longopts, &option); 212 c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:46", longopts, &option);
210 213
211 if (c == -1 || c == EOF) 214 if (c == -1 || c == EOF)
212 break; 215 break;
@@ -269,6 +272,12 @@ process_arguments (int argc, char **argv)
269 case 'a': 272 case 'a':
270 expected_address = optarg; 273 expected_address = optarg;
271 break; 274 break;
275 case '4':
276 query_transport = "-4";
277 break;
278 case '6':
279 query_transport = "-6";
280 break;
272 default: /* usage5 */ 281 default: /* usage5 */
273 usage5(); 282 usage5();
274 } 283 }
@@ -325,6 +334,10 @@ print_help (void)
325 334
326 printf (UT_HOST_PORT, 'p', myport); 335 printf (UT_HOST_PORT, 'p', myport);
327 336
337 printf (" %s\n","-4, --use-ipv4");
338 printf (" %s\n",_("Force dig to only use IPv4 query transport"));
339 printf (" %s\n","-6, --use-ipv6");
340 printf (" %s\n",_("Force dig to only use IPv6 query transport"));
328 printf (" %s\n","-l, --query_address=STRING"); 341 printf (" %s\n","-l, --query_address=STRING");
329 printf (" %s\n",_("Machine name to lookup")); 342 printf (" %s\n",_("Machine name to lookup"));
330 printf (" %s\n","-T, --record_type=STRING"); 343 printf (" %s\n","-T, --record_type=STRING");