File dnswalk-unpingable.patch of Package dnswalk
Description: Patch to allow unpingable nameserversto be ignored if queries to them time out.
Author: Paul Wayper
Origin: other, https://sourceforge.net/p/dnswalk/patches/4/
Bug:
Last-Update: 2010-11-25
This patch gives dnswalk the -t option, which allows unpingable nameservers to be ignored if queries to them time out.
Put another way: if a name server is returning 'query timed out', the -t option then allows you to ignore this nameserver if it is also unpingable.
I coded this option when we had a data centre move and some of our nameservers were down. Since we run Nagios we already knew the servers were down...
#--- dnswalk-20101125-pjw 2010-11-25 11:20:50.000000000 +1100
#+++ dnswalk 2010-11-25 11:36:17.000000000 +1100
#@@ -17,12 +17,14 @@
# # dnswalk has been run previously.)
# # -F Enable "facist" checking. (See man page)
# # -l Check lame delegations
#+# -t Ignore query timeouts on unpingable nameservers
#
# use Getopt::Std;
# use IO::Socket;
# use Net::DNS;
#+use Net::Ping;
#
#-getopts("D:rfiadmFl");
#+getopts("D:rfiadmFlt");
#
# $num_error{'FAIL'}=0; # failures to access data
# $num_error{'WARN'}=0; # questionable data
#@@ -403,10 +405,15 @@
# }
# $soa_req = $res->send($packet);
# unless (defined($soa_req)) {
#- &printerr("FAIL",
#- "Cannot get SOA record for $zone from $nameserver (lame?): ".
#- $res->errorstring ."\n");
#- return;
#+ if ($res->errorstring eq 'query timed out' and $opt_t) {
#+ # If we can't ping the machine, don't warn about the query timing out.
#+ my $p = Net::Ping->new('icmp');
#+ return unless $p->ping($nameserver, 4);
#+ }
#+ &printerr("FAIL",
#+ "Cannot get SOA record for $zone from $nameserver (lame?): ".
#+ $res->errorstring ."\n");
#+ return;
# }
# &printerr("BAD", "$zone NS $nameserver: lame NS delegation\n")
# unless ($soa_req->header->aa);
--- dnswalk.orig 2018-12-27 12:34:54.981105029 +0100
+++ dnswalk 2018-12-27 12:37:59.847476898 +0100
@@ -17,14 +17,16 @@
# dnswalk has been run previously.)
# -F Enable "facist" checking. (See man page)
# -l Check lame delegations
+# -t Ignore query timeouts on unpingable nameservers
use Getopt::Std;
use IO::Socket;
use Net::DNS;
use Net::IP;
+use Net::Ping;
use Socket6;
-getopts("D:rfiadmFl");
+getopts("D:rfiadmFlt");
$num_error{'FAIL'}=0; # failures to access data
$num_error{'WARN'}=0; # questionable data
@@ -152,9 +154,15 @@
my ($packet) = new Net::DNS::Packet($zone, "SOA", "IN");
my ($soa_req) = $res->send($packet);
unless (defined($soa_req)) {
- &printerr("FAIL", "Cannot get SOA record for $zone:" .
- $res->errorstring . "\n");
- return "";
+ if ($res->errorstring eq 'query timed out' and $opt_t) {
+ # If we can't ping the machine, don't warn about the query timing out.
+ my $p = Net::Ping->new('icmp');
+ return unless $p->ping($nameserver, 4);
+ }
+ &printerr("FAIL",
+ "Cannot get SOA record for $zone from $nameserver (lame?): ".
+ $res->errorstring ."\n");
+ return;
}
unless (($soa_req->header->ancount >= 1) &&
(($soa_req->answer)[0]->type eq "SOA")) {