Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I don't know if the spanner range stuff in Net::CIDR::Lite would've helped you any, but there it is on CPAN. The first part was just written just as a response to one of MJD's puzzles, and the 'find which CIDR range object(s) an IP address is in' part was written later for the fun of it. Though it doesn't 'find which range object(s) a CIDR address is in', if that's what you needed.
    • This module probably does almost exactly what I've developed, with the minor exception that you're just creating one big list and not caring about a LHS and a RHS. I imagine that could be added somehow if I were so inclined (but I'm not, since my code works now :-)

      It also probably uses a lot more RAM than mine. I tried to keep everything on disk because of the sheer volume of IPs (totaling just over 2 million). We tried to do everything in RAM but it used about 600M of memory, which is too much on an alrea
      • One of MJD's test files had 65536 separate but contiguous x/32 CIDR addresses to merge. If addresses's are contiguous then the middle node is deleted, and the hash object is left with just the start and end of the joined range. If ranges are overlapping, then periodic calls to 'clean' will eliminate the overlapping nodes. If you have many completely separate ranges, then yeah it'll take alot of memory. I'm not sure what you mean by LHS and RHS though (well, I know what they mean, but not the context here :-)

        And the original 'puzzle' was posted here [] if anyone's interested.

        • Ah, by LHS and RHS I mean that say I'm merging lists A and B, I assign to A, and to B, and where I get overlaps I expect to find This has to work for multiple such lists.
          • I assign to A, and to B, and where I get overlaps I expect to find

            Ah, then (I think) it would've been easily doable with Net::CIDR::Lite, though what you ended up with is probably more efficient speed and memory-wise, especially if there are alot of lists (and I admit the docs of N::C::L are lacking).

            Instead of merging the lists, you'd create a 'spanner' object (dumb name, but I didn't know what else to call it), where the labels are the Socket::inet_aton() of what you want assig