Perl Monk, Perl Meditation | |
PerlMonks |
Splitting IP ranges depending on overlap conditionsby kamesh3183 (Beadle) |
on Apr 14, 2006 at 11:31 UTC ( [id://543317]=perlquestion: print w/replies, xml ) | Need Help?? |
kamesh3183 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Background: I have two lists (L1 & L2) each containing an IP range and information about them(like country, state, zip..etc). List L1 is dynamically generated and it can contain more than 10 million records. L2 has 50-100 records. It is not necessary that these IP ranges are valid IP blocks. I have to iterate through the list L1 and check whether any of the IP range overlaps with any range in the L2 and if it overlaps, then substitute the information of L1 with L2 for matching range only(If the range does not overlaps completely then i need to split the range of L1). for example take a simple case; if current L1 record is 81.68.0.0 - 81.68.0.20, xyz and L2 record is 81.68.0.0 - 81.68.0.10, abc L1 recors must be splitted into 81.68.0.0 - 81.68.0.10, abc and 81.68.0.11 - 81.68.0.20, xyz I have gone through Net::IP module and found that it can used for testing overlap conditions but I am not sure about splitting ranges. Could you please tell is there any module on CPAN that can do this thing? Thanks Kamesh
Back to
Seekers of Perl Wisdom
|
|