chiark / gitweb /
chiark-named-conf gets list of delegated servers right when doing simple checks ...
[chiark-utils.git] / scripts / named-conf
index bad6caa6c6cd2e42b866cf633ec01bbcbe92c68b..68765c6cc19135d4a5d7f572ff50cf9576c59f9b 100755 (executable)
@@ -65,22 +65,29 @@ usageerr("must specify either -f|-y|-n or zones (and not both)")
     if !!$mode == !!@ARGV;
 
 sub usageerr ($) {
-    die
-"$_[0]
-usage: named-conf-regen [options] -f|-y|-n|<zone>...\n".
-"operation modes:\n".
-" -f --force   install without checking\n".
-" -y --yes     check and install\n".
-" -n --no      check only\n".
-"additional options:\n".
-" -A --all       report on zones marked ? (ones we know are broken)\n".
-" -D             debug $quis (does not help debug your DNS config)\n".
-" -g --glueless  do not warn about any glueless referrals (not recommended)\n".
-" -l --localonly full checks only on zones which we primary\n".
-" -q --quiet     no output for OK zones\n".
-" -r --repeat    repeat warnings for all sources of imperfect data\n".
-" -v --verbose   extra verbose info about each zone\n".
-" -C|--config <DIR/FILE  use FILE as default config and DIR as default dir\n";
+    die <<END;
+$_[0]
+
+usage: chiark-named-conf [options] -f|-y|-n|<zone>...
+operation modes:
+ -f --force   install without checking
+ -y --yes     check and install
+ -n --no      check only (configured zones)
+ <zone> ...   check only (specified zones, even unconfigured ones)
+additional options:
+ -A --all       report on zones marked ? (ones we know are broken)
+ -D             debug $quis (does not help debug your DNS config)
+ -g --glueless  do not warn about any glueless referrals (not recommended)
+ -l --localonly full checks only on zones which we primary
+ -q --quiet     no output for OK zones
+ -r --repeat    repeat warnings for all sources of imperfect data
+ -v --verbose   extra verbose info about each zone
+ -C|--config <DIR/FILE  use FILE as default config and DIR as default dir
+
+chiark-named-conf is Copyright 2002 Ian Jackson.  It is Free software, under
+the GNU General Public License, and you are welcome to change it and/or
+distribute copies under certain conditions.  There is ABSOLUTELY NO WARRANTY.
+END
 }
 
 cfg_fail("config filename $etcfile should not be directory")
@@ -391,8 +398,8 @@ sub zone_investigate() {
 
 sub zone_check_nsrrset ($$$$) {
     my ($uaddr,$wa, $name_if_auth, $glueless_ok) = @_;
-    my (@s, $s, %s2g, @glue, $glue, $delgs_or_auths, $wwn, $ww);
-    my ($rcode, $sa);
+    my (@s, $s, $a, %s2g, @glue, $glue, $delgs_or_auths, $wwn, $ww);
+    my ($rcode);
     $ww= "[$uaddr] $wa";
     verbose("checking delegation by $ww");
     dig(sub {
@@ -401,6 +408,7 @@ sub zone_check_nsrrset ($$$$) {
        } elsif ($dig_type eq 'a' && exists $s2g{$dig_owner}) {
            $wwn= "in glue from $ww";
            push @to_check, $dig_rdata, "$dig_owner, $wwn", $dig_owner, 0;
+           zone_server_addr($dig_rdata,$dig_owner,$wwn,"NS [$uaddr]",0);
            push @{ $s2g{$dig_owner} }, $dig_rdata;
        }
     },
@@ -422,9 +430,11 @@ sub zone_check_nsrrset ($$$$) {
                       grep { has_suffix_of($s,".$_"); }
                           @{ $cfg->{'conv_glueless'} };
            ($rcode,@glue)= lookup($s,'a','0',"glueless NS from $ww");
-       }
-       foreach ($sa) {
-           zone_server_addr($sa,$s,$wwn,"NS [$uaddr]",0);
+           foreach $a (@glue) {
+               $wwn= "glueless NS from $ww";
+               push @to_check, $a, "$s, $wwn", $s, 0;
+               zone_server_addr($a,$s,$wwn,"NS [$uaddr]",0);
+           }
        }
        $glue= join ' ', sort @glue;
        push @{ $glue{$s}{$glue} }, $ww;
@@ -570,6 +580,7 @@ sub zone_servers_simplefind () {
        zone_ns_name($ns,"NS");
        zone_server_simple($ns,'NS',0);
     }
+    $delgs{join ' ', sort @nsnames} = [ "zone's servers" ];
 
     ($rcode,@soas)= lookup($zone,'soa','0',"SOA ORIGIN");
     die "multiple SOA RRs in set!  @soas ?" if @soas!=1;