Philip Prindeville wrote:
> 
> my %badnetworks = {
>     '58.71.0.0/17'      => 'REJECT',
>     '62.117.127.0/25'   => 'REJECT',
...
>     '222.136.0.0/11'    => 'REJECT',
>     # local mail
>     '127.0.0.1/32'      => 'ACCEPT',
>     '192.168.1.0/24'    => 'ACCEPT',
>     # wildcard action
>     '0.0.0.0/0'         => 'ACCEPT',
> };
> 
... 
>     while (my ($lhs, $action) = each %badnetworks) {
>         my ($net, $length) = split('/', $lhs);

Umm... note that each %hash returns the key/value pairs in hash order.  This is 
NOT NECESSARILY THE SAME as the order you entered them into the hash.  If you 
happen to hit 0.0.0.0/0 => ACCEPT as the first entry none of your blacklists 
will take effect.

You could fix this by using two arrays:

my @badnetworks = ( '58.71.0.0/17', ...);
my @goodnetworks = ( '127.0.0.1/32', ... );

and iterating over each separately.

-- 
Matthew.van.Eerde (at) hbinc.com               805.964.4554 x902
Hispanic Business Inc./HireDiversity.com       Software Engineer

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to