Changeset 48


Ignore:
Timestamp:
12/09/14 16:29:34 (10 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Add hard maximum depth check based on the number of available bits
in the result.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBL.pm

    r40 r48  
    103103our @howmany = (1,128,64,32,16,8,4,2,1,128,64,32,16,8,4,2,1,128,64,32,16,8,4,2,1,128,64,32,16,8,4,2);
    104104
     105# hard max depth.  There are not enough bits in a 32-bit IP in 127/8 for more than 7 sets of 3 block-level
     106# flags, plus one for the IP, plus one for an "alternate" IP flag, plus reserving the least significant bit
     107# as a "don't use this because Reasons"
     108our $maxlvl = 6;
     109
    105110# variables
    106111our $dbh;
     
    361366# whee! Recursion is Fun!
    362367# Call ourself to dig down through the layers of blocks from registar-allocation
    363 # (level 0) to final block (level n, not to exceed 2)
     368# (level 0) to final block (level n, not to exceed $maxlvl)
    364369# Take a reference to a hash, and stuff it full of blacklisting goodness.
    365370# Optionally accept a level, block-container, and OOB block and org arguments for
     
    380385  my $bitmask = shift || 0;
    381386
    382   if ($level > 3) {
     387  if ($level > $maxlvl) {
    383388    warn "getting too deep, breaking off! ($container, $level)\n";
    384389    return;
Note: See TracChangeset for help on using the changeset viewer.