Changeset 332


Ignore:
Timestamp:
05/09/12 20:22:07 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Checkpoint updating export for reverse zones. See #26.

  • Rework PTR handling for actual storage method used
  • Tweak _ZONE (again) so it doesn't chop off a trailing 0 in an IPv6 IP address
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r331 r332  
    843843      }
    844844      # Split and reverse the order of the nibbles in the network/broadcast IPs
    845       $prefix =~ s/0$// if $zone->masklen % 4 == 0;     # trim another 0 for nibble-aligned blocks first
     845      # trim another 0 for nibble-aligned blocks first, but only if we really have a block, not an IP
     846      $prefix =~ s/0$// if $zone->masklen % 4 == 0 && $zone->masklen != 128;
    846847      my @nbits = reverse split //, $prefix;
    847848      my @bbits = reverse split //, $bc;
     
    41474148      } elsif ($typemap{$type} eq 'PTR') {
    41484149
    4149         # must handle both IPv4 and IPv6
    4150 ##work
    4151         # data should already be in suitable reverse order.
    4152         print $datafile "^$host:$val:$ttl:$stamp:$loc\n";
     4150        $zone = NetAddr::IP->new($zone);
     4151        if (!$zone->{isv6} && $zone->masklen > 24) {
     4152          ($val) = ($val =~ /\.(\d+)$/);
     4153          print $datafile "^$val."._ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
     4154                ":$host:ttl:$stamp:$loc\n";
     4155        } else {
     4156          $val = NetAddr::IP->new($val);
     4157          print $datafile "^".
     4158                _ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
     4159                ":$host:ttl:$stamp:$loc\n";
     4160        }
    41534161
    41544162      } else {
Note: See TracChangeset for help on using the changeset viewer.