Changeset 601
- Timestamp:
- 03/25/14 17:29:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r600 r601 4647 4647 # Handles sub-octet v4 zones in the format specified in the Cricket Book, 2nd Ed, p217-218 4648 4648 4649 if ($zone =~ m{(?:\.arpa\.?|/\d+ )$}) {4649 if ($zone =~ m{(?:\.arpa\.?|/\d+|^[\d.]+|^[a-fA-F0-9:]+)$}) { 4650 4650 # we seem to have a reverse zone 4651 4651 $rev = 'y'; … … 4660 4660 $cidr = NetAddr::IP->new($zone) or return ('FAIL',"$zone is not a valid CIDR block"); 4661 4661 $zone = _ZONE($cidr, 'ZONE.in-addr.arpa', 'r', '.'); 4662 } elsif ($zone =~ /^[\d.]+$/) { 4663 # v4 revzone, leading-octet format 4664 my $mask = 32; 4665 while ($zone !~ /^\d+\.\d+\.\d+\.\d+$/) { 4666 $zone .= '.0'; 4667 $mask -= 8; 4668 } 4669 $zone .= "/$mask"; 4670 $cidr = NetAddr::IP->new($zone) or return ('FAIL',"$zone is not a valid CIDR block"); 4671 $zone = _ZONE($cidr, 'ZONE.in-addr.arpa', 'r', '.'); 4662 4672 } elsif ($zone =~ m|^[a-fA-F\d:]+/\d+$|) { 4663 4673 # v6 revzone, CIDR netblock … … 4665 4675 return ('FAIL', "$zone is not a nibble-aligned block") if $cidr->masklen % 4 != 0; 4666 4676 $zone = _ZONE($cidr, 'ZONE.ip6.arpa', 'r', '.'); 4677 } elsif ($zone =~ /^[a-fA-F\d:]+$/) { 4678 # v6 revzone, leading-group format 4679 $zone =~ s/::$//; 4680 my $mask = 128; 4681 while ($zone !~ /^(?:[a-fA-F\d]{1,4}:){7}[a-fA-F\d]$/) { 4682 $zone .= ":0"; 4683 $mask -= 16; 4684 } 4685 $zone .= "/$mask"; 4686 $cidr = NetAddr::IP->new($zone) or return ('FAIL',"$zone is not a valid CIDR block"); 4687 $zone = _ZONE($cidr, 'ZONE.ip6.arpa', 'r', '.'); 4667 4688 } else { 4668 4689 # there is. no. else! 4669 return ('FAIL', "Unknown zone name format"); 4670 } 4690 return ('FAIL', "Unknown zone name format '$zone'"); 4691 } 4692 4693 # several places this can be triggered from; better to do it once. 4694 $warnmsg .= "Apparent sub-/64 IPv6 reverse zone\n" if $cidr->masklen > 64; 4671 4695 4672 4696 # quick check to start to see if we've already got one
Note:
See TracChangeset
for help on using the changeset viewer.