Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Seeking CPAN module I used once to merge CIDR blocks

by blue_cowdawg (Monsignor)
on Apr 06, 2015 at 16:59 UTC ( [id://1122579]=perlquestion: print w/replies, xml ) Need Help??

blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:

So, in my role as head Puppeteer I don't get to write much Perl like I used to and sure enough I have a need to. I am writing a script that will download from Stop Forum Spam a huge list of toxic CIDR addresses and using that list go generate a Puppet class to put rules into IPTables to drop connections from those CIDR ranges.

I wrote something like this back around 2005 and I remember using a CPAN module that would take a huge list like that, sort the CIDR blocks and merge CIDR blocks as made sense. Worked great. Lasted a long time and as far as I know my client is still using that script.

Problem is as I get older I now realize that memory is the second thing you lose (I forgot what the first was) and I can't remember which CPAN moudle I used to do that. I searched CPAN and I can't find it.

Anyone out there know which module it is?


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; Blog: http://blog.berghold.net Warning: No political correctness allowed.
  • Comment on Seeking CPAN module I used once to merge CIDR blocks

Replies are listed 'Best First'.
Re: Seeking CPAN module I used once to merge CIDR blocks
by dasgar (Priest) on Apr 06, 2015 at 17:52 UTC

    Doing a quick search, it looks like Net::CIDR::Set provides a merge functionality. Also, it provides a few iterators that returns addresses or CIDR blocks in ascending order. With one of the iterators, I think it's possible to make your own sorting subroutine.

Re: Seeking CPAN module I used once to merge CIDR blocks
by karlgoethebier (Abbot) on Apr 06, 2015 at 17:05 UTC
    ...sort the CIDR blocks and merge CIDR blocks as made sense

    I guess: Net::CIDR::Lite or Net::CIDR?

    Edit: Added link to a node the OP contributed... ;-)

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1122579]
Approved by MidLifeXis
Front-paged by MidLifeXis
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-24 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found