Bug #2892

"pfblocker_Range2CIDR" function yields erroneous results (pfBlocker v1.0.2)

Added by B. Derman over 7 years ago. Updated over 5 years ago.

Country Block
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected Version:
Affected Architecture:


E.G. the file
on 2013-Mar-18 has/had an entry (on line 165):
ADC01/ADC06 ads:

Using the "pfblocker_Range2CIDR" function contained in /usr/local/pkg/ in pfBlocker v1.0.2 to convert the IP address range:
--- to

yields a CIDR represenation of:

but "expands" to the 4 incorrect IP addressses:

... whereas, using the "ip_range_to_subnet_array" function contained in /etc/inc/ in pfSense v2.0.2 to convert the IP address range:
--- to

yields CIDR represenations of:

which collectively "expand" to the 4 (correct) IP addresses:

Not sure why the existing pfSense function wasn't used, but it appears that the one in pfBlocker will, in some instances, will generate CIDRs that can cause "good guy" IPs to be blocked and "bad guy" IPs to remain unblocked. On the plus side, fixing the bug should be as easy as switching to the function supplied by pfSense.

Regardless, I certainly appreciate the pfBlocker package and will be sending a small donation in as soon as our PayPal account gets refilled.


#1 Updated by B. Derman over 7 years ago

When doing some addtional work, I noticed that I mistyped the CIDR generated by the "pfblocker_Range2CIDR" function -- for the IP range, it actually generates a CIDR representation of:

and expands to the (still mostly incorrect) IP addresses:

This all means that the following examples are true
(on 2013-03-27 : lists from

List Name : # of erroneous CIDRs generated by pfBlocker ===
Bluetack ads : at least 100
Bluetack forumspam : at least 10
Bluetack hijacked : at least 15
Bluetack spyware : at least 100

Note that each erroneous CIDR often yields multiple erroneous IP addresses -- i.e., where each erroneous IP is a "good guy" that's wrongly being blocked and omits an IP that is a "bad guy" that's not being blocked.

#2 Updated by Phillip Davis over 7 years ago

#3 Updated by Phillip Davis over 7 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

Applied in changeset commit:e2ec86f40c9573292a46d4ab89ae70e353a99f8f.

#4 Updated by Chris Buechler over 5 years ago

  • Status changed from Feedback to Resolved
  • Affected Documentation 0 added

Also available in: Atom PDF