Changeset 776 for trunk


Ignore:
Timestamp:
07/31/19 16:44:40 (5 years ago)
Author:
Kris Deugau
Message:

/trunk

Add retrieval of SOA serial numbers from DB for export. See #24.

First pass adding managed serial number support should be complete. Still
needs some refinements and extending to support schemes other than unixtime.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r775 r776  
    65106510    # host contains pri-ns:responsible
    65116511    # val is abused to contain refresh:retry:expire:minttl
    6512 ##fixme:  "manual" serial vs tinydns-autoserial
    65136512    # let's be explicit about abusing $host and $val
    65146513    my ($email, $primary) = (split /:/, $host)[0,1];
    65156514    my ($refresh, $retry, $expire, $min_ttl) = (split /:/, $val)[0,1,2,3];
     6515    my $serial = 0;
    65166516    if ($revrec eq 'y') {
    65176517##fixme:  have to publish SOA records for each v4 /24 in sub-/16, and each /16 in sub-/8
     
    65196519# -> only need SOA for local chunks offset from reverse delegation boundaries, so v6 is fine
    65206520# anyone who says they need sub-nibble v6 delegations, at this time, needs their head examined.
     6521##fixme?:  alternate SOA serial schemes?
     6522      ($serial) = $self->{dbh}->selectrow_array("SELECT zserial FROM revzones WHERE revnet=?", undef, $zone);
    65216523      $zone = NetAddr::IP->new($zone);
    65226524      # handle split-n-multiply SOA for off-octet (8 < mask < 16) or (16 < mask < 24) v4 zones
     
    65246526        foreach my $szone ($zone->split($zone->masklen + (8 - $zone->masklen % 8))) {
    65256527          $szone = _ZONE($szone, 'ZONE.in-addr.arpa', 'r', '.');
    6526           print $datafile "Z$szone:$primary:$email"."::$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
     6528          print $datafile "Z$szone:$primary:$email:$serial:$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
    65276529            or die $!;
    65286530        }
     
    65306532      }
    65316533      $zone = _ZONE($zone, 'ZONE', 'r', '.').($zone->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
    6532     }
    6533     print $datafile "Z$zone:$primary:$email"."::$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
     6534    } else {
     6535      # just snarfing the right SOA serial for the zone type
     6536##fixme?:  alternate SOA serial schemes?
     6537      ($serial) = $self->{dbh}->selectrow_array("SELECT zserial FROM domains WHERE domain=?", undef, $zone);
     6538    } # revrec <> 'y'
     6539    $serial = '' if !$serial; # suppress a "uninitialized value" warning.  empty serial isn't an error, just falls back to tinydns' autoser$
     6540    print $datafile "Z$zone:$primary:$email:$serial:$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
    65346541      or die $!;
    65356542  } # SOA
Note: See TracChangeset for help on using the changeset viewer.