Line | |
---|
1 | #!/usr/bin/perl
|
---|
2 | #
|
---|
3 | open STDIN,shift @ARGV
|
---|
4 | or die "Cannot open $_:$!"
|
---|
5 | if @ARGV;
|
---|
6 |
|
---|
7 | $domain = '.';
|
---|
8 |
|
---|
9 | while(<STDIN>) {
|
---|
10 |
|
---|
11 | if (m/\$ORIGIN\s+([\w\-\.]+)/) {
|
---|
12 | $domain = lc $1;
|
---|
13 | next;
|
---|
14 | };
|
---|
15 | next
|
---|
16 | unless m/^\s*([\w\-\.]+)\s+(IN\s+)?A\s+([\d\.]+)/i;
|
---|
17 |
|
---|
18 | my ($host,$ip) = (lc $1,lc $3);
|
---|
19 |
|
---|
20 | $host .= '.'.$domain
|
---|
21 | unless $host =~ m/\.$/;
|
---|
22 |
|
---|
23 | warn "A-Resourcce Duplicated\n\tfor $ip/$host at line $.\n"
|
---|
24 | if defined $host{$ip} and $host{$ip} eq $host;
|
---|
25 |
|
---|
26 | warn "A-Resourcce Conflict\n\t$ip used for $host and $host{$ip} at line $.\n"
|
---|
27 | if defined $host{$ip};
|
---|
28 |
|
---|
29 | warn "Resource reuse\n\t$host at $ip{$host}/$ip at line $.\n"
|
---|
30 | if defined $ip{$host} and $ip eq $ip{$host};
|
---|
31 |
|
---|
32 | warn "Resourcce mismatch\n\t$host at $ip{$host} and $ip at line $.\n"
|
---|
33 | if defined $ip{$host};
|
---|
34 |
|
---|
35 | $host{$ip} = $host;
|
---|
36 | $ip{$host} = $ip;
|
---|
37 |
|
---|
38 | print "$ip\t$host\n";
|
---|
39 | };
|
---|
40 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.