Jelajahi Sumber

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)
Alexander Wittig 12 tahun lalu
induk
melakukan
e7e397057a
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      plugins/check_dig.c

+ 4 - 1
plugins/check_dig.c

@@ -305,7 +305,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");
     }
   }