Changeset 616 for branches/stable


Ignore:
Timestamp:
10/24/13 10:30:15 (11 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Fix a nasty edge case with /32 netblock allocations. Strictly speaking
these should probably be set up as IP pools. The new database structure
on /trunk will bypass this class of problem by not using just the CIDR
as a key.
Bump patch version for release.

Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/Makefile

    r615 r616  
    33
    44PKGNAME=ipdb
    5 VERSION=2.8.1
     5VERSION=2.8.2
    66RELEASE=1
    77
  • branches/stable/cgi-bin/IPDB.pm

    r612 r616  
    12871287  my $poolip = 0;
    12881288
     1289my $binfo;
     1290## hack ptui
     1291# the current DB does not lend itself well to /32 netblock allocations.
     1292# this hack should work around that lack so that such allocations can be manipulated:
     1293# instead of inspecting $block/$cidr to see if it's an IPv4 /32,
     1294# we brute-force it and just see if there's anything in the allocations
     1295# table first, then if nothing was found check the poolips table
     1296$binfo = $dbh->selectrow_hashref("SELECT $keycol AS block, custid, type, city, circuitid, description,".
     1297        " notes, modifystamp AS lastmod, privdata, vrf".($poolip ? '' : ', swip')." FROM $blocktable".
     1298        " WHERE $keycol = ?", undef, ($block) );
     1299
     1300## this only works if blocks are never /32.  *sigh*
    12891301  # Pool IP and IPv6 check all in one!  Still needs to be tightened
    12901302  # up a little for the as-yet-unhandled case of IPv6 IP pools
    1291   if ($cidr->bits == 32 && $cidr->masklen == 32) {
     1303#  if ($cidr->bits == 32 && $cidr->masklen == 32) {
     1304  if (!$binfo) {
    12921305    $poolip = 1;
    12931306    $keycol = 'ip';
    12941307    $blocktable = 'poolips';
    1295   }
    1296   my $binfo = $dbh->selectrow_hashref("SELECT $keycol AS block, custid, type, city, circuitid, description,".
     1308    $binfo = $dbh->selectrow_hashref("SELECT $keycol AS block, custid, type, city, circuitid, description,".
    12971309        " notes, modifystamp AS lastmod, privdata, vrf".($poolip ? '' : ', swip')." FROM $blocktable".
    12981310        " WHERE $keycol = ?", undef, ($block) );
     1311  }
    12991312  return $binfo;
    13001313} # end getBlockData()
Note: See TracChangeset for help on using the changeset viewer.