Changeset 753 for trunk


Ignore:
Timestamp:
06/29/15 18:31:06 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Start fine-tuning flag storage for deciding if we can/should do an RPC
call for rDNS. See #41.

  • Tweak getBlockData with an additional JOIN to fill in the revavailable and revpartial fields. The dnsavail table maps various larger-than-/24 parents to sets of actual /24 reverse zones (should work fine with /16 too) to let eg suitable sets of /29 blocks in a /22 make RPC calls or not, depending on which /24 the allocation is in.
  • Add bypass return in mergeBlocks() based on revavailable or revpartial being set on the allocation. For now this is just a simple yes/no; future changes could do more complex things depending on which one was set how.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r752 r753  
    24562456# ...  er, how do we detect this?
    24572457
     2458  # Return early if the block wasn't flagged as rDNS-able
     2459  return \@retlist unless $binfo->{revavail} || $binfo->{revpartial};
     2460
    24582461  if ($args{newtype} =~ /.[cm]/) {
    24592462
     
    29142917  } else {
    29152918    my $binfo = $dbh->selectrow_hashref(qq(
    2916         SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, swip, $commonfields,
    2917                 f.cidr AS reserve, f.id as reserve_id
    2918         FROM allocations a LEFT JOIN freeblocks f ON a.id=f.reserve_for
     2919        SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, swip, revzone, $commonfields,
     2920                f.cidr AS reserve, f.id as reserve_id,
     2921                d.zone >>= a.cidr AS revavail, d.zone << a.cidr AS revpartial
     2922        FROM allocations a
     2923        LEFT JOIN freeblocks f ON a.id=f.reserve_for
     2924        LEFT JOIN dnsavail d ON a.parent_id = d.parent_alloc AND (a.cidr <<= d.zone OR a.cidr >> d.zone)
    29192925        WHERE a.id = ?
    29202926        ), undef, ($id) );
Note: See TracChangeset for help on using the changeset viewer.